1010from termcolor import colored
1111import psutil
1212import time
13+ import os
1314
1415
1516def make_classification (X_train , X_test , y_train , y_test , timelife , y , time_start ):
1617 # Classification model
1718 automl = autosklearn .classification .AutoSklearnClassifier (
18- time_left_for_this_task = timelife * 60 ,
19- per_run_time_limit = 30 ,
20- memory_limit = int (int (psutil .virtual_memory ().available * 1e-6 ) * 0.75 ),
21- n_jobs = - 1 ,
22- resampling_strategy_arguments = {'cv' : 10 }
23- )
19+ time_left_for_this_task = timelife * 60 ,
20+ per_run_time_limit = 30 ,
21+ memory_limit = int (int (psutil .virtual_memory ().available * 1e-6 ) * 0.75 ) / os . cpu_count ( ),
22+ n_jobs = - 1 ,
23+ resampling_strategy_arguments = {'cv' : 10 }
24+ )
2425 automl .fit (X_train , y_train )
2526 y_pred = automl .predict (X_test )
2627 pipelines = str (pd .DataFrame (pd .Series (automl .show_models ())).iloc [0 ].squeeze ()) # Pipeline
@@ -38,12 +39,12 @@ def make_classification(X_train, X_test, y_train, y_test, timelife, y, time_star
3839def make_regression (X_train , X_test , y_train , y_test , timelife , time_start ):
3940 # Regression model
4041 automl = autosklearn .regression .AutoSklearnRegressor (
41- time_left_for_this_task = timelife * 60 ,
42- per_run_time_limit = 30 ,
43- memory_limit = int (int (psutil .virtual_memory ().available * 1e-6 ) * 0.75 ),
44- n_jobs = - 1 ,
45- resampling_strategy_arguments = {'cv' : 10 }
46- )
42+ time_left_for_this_task = timelife * 60 ,
43+ per_run_time_limit = 30 ,
44+ memory_limit = int (int (psutil .virtual_memory ().available * 1e-6 ) * 0.75 ) / os . cpu_count ( ),
45+ n_jobs = - 1 ,
46+ resampling_strategy_arguments = {'cv' : 10 }
47+ )
4748 automl .fit (X_train , y_train )
4849 y_pred = automl .predict (X_test )
4950 pipelines = str (pd .DataFrame (pd .Series (automl .show_models ())).iloc [0 ].squeeze ().split ('\n ' )) # Pipeline
0 commit comments