Free up memory during model building.
parent
b505fb2b6a
commit
35c09374dd
|
@ -191,10 +191,12 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "dummy"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del dummy_regr
|
||||
del dummy_regr_scores
|
||||
|
||||
lin_reg_rapids = linear_model.LinearRegression()
|
||||
lin_reg = linear_model.LinearRegression()
|
||||
lin_reg_scores = cross_validate(
|
||||
lin_reg_rapids,
|
||||
lin_reg,
|
||||
X=data_x,
|
||||
y=data_y,
|
||||
groups=data_groups,
|
||||
|
@ -209,6 +211,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "linear_reg"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del lin_reg
|
||||
del lin_reg_scores
|
||||
|
||||
ridge_reg = linear_model.Ridge(alpha=0.5)
|
||||
ridge_reg_scores = cross_validate(
|
||||
|
@ -226,6 +230,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "ridge_reg"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del ridge_reg
|
||||
del ridge_reg_scores
|
||||
|
||||
lasso_reg = linear_model.Lasso(alpha=0.1)
|
||||
lasso_reg_score = cross_validate(
|
||||
|
@ -243,6 +249,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "lasso_reg"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del lasso_reg
|
||||
del lasso_reg_score
|
||||
|
||||
bayesian_ridge_reg = linear_model.BayesianRidge()
|
||||
bayesian_ridge_reg_score = cross_validate(
|
||||
|
@ -260,6 +268,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "bayesian_ridge"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del bayesian_ridge_reg
|
||||
del bayesian_ridge_reg_score
|
||||
|
||||
ransac_reg = linear_model.RANSACRegressor()
|
||||
ransac_reg_score = cross_validate(
|
||||
|
@ -277,6 +287,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "RANSAC"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del ransac_reg
|
||||
del ransac_reg_score
|
||||
|
||||
svr = svm.SVR()
|
||||
svr_score = cross_validate(
|
||||
|
@ -294,6 +306,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "SVR"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del svr
|
||||
del svr_score
|
||||
|
||||
kridge = kernel_ridge.KernelRidge()
|
||||
kridge_score = cross_validate(
|
||||
|
@ -311,6 +325,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "kernel_ridge"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del kridge
|
||||
del kridge_score
|
||||
|
||||
gpr = gaussian_process.GaussianProcessRegressor()
|
||||
gpr_score = cross_validate(
|
||||
|
@ -328,6 +344,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "gaussian_proc"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del gpr
|
||||
del gpr_score
|
||||
|
||||
rfr = ensemble.RandomForestRegressor(max_features=0.3, n_jobs=-1)
|
||||
rfr_score = cross_validate(
|
||||
|
@ -345,6 +363,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "random_forest"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del rfr
|
||||
del rfr_score
|
||||
|
||||
xgb = XGBRegressor()
|
||||
xgb_score = cross_validate(
|
||||
|
@ -362,6 +382,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "XGBoost"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del xgb
|
||||
del xgb_score
|
||||
|
||||
ada = ensemble.AdaBoostRegressor()
|
||||
ada_score = cross_validate(
|
||||
|
@ -379,6 +401,8 @@ def run_all_regression_models(
|
|||
scores_df = scores_df.agg(["max", np.nanmedian]).transpose()
|
||||
scores_df["method"] = "ADA_boost"
|
||||
scores = pd.concat([scores, scores_df])
|
||||
del ada
|
||||
del ada_score
|
||||
|
||||
return scores
|
||||
|
||||
|
|
Loading…
Reference in New Issue