-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautolearn.py
32 lines (27 loc) · 1.28 KB
/
autolearn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pandas as pd
from pandas.core.series import Series#for type hint that helps intellisense
import autosklearn.regression
import autosklearn.classification
import sklearn.model_selection
SECONDS_PER_DATASET = 62
SECONDS_PER_MODEL = 30
def run_regression_ensemble(X: Series, y: Series) -> autosklearn.regression.AutoSklearnRegressor:
# X_train, X_test, y_train, y_test = \
# sklearn.model_selection.train_test_split(X, y, random_state=1)
automl = autosklearn.regression.AutoSklearnRegressor(
time_left_for_this_task=SECONDS_PER_DATASET,
per_run_time_limit=SECONDS_PER_MODEL,
scoring_functions=[autosklearn.metrics.mean_squared_error]
)
automl.fit(X, y)
return automl
def run_classification_ensemble(X: Series, y: Series) -> autosklearn.classification.AutoSklearnClassifier:
# X_train, X_test, y_train, y_test = \
# sklearn.model_selection.train_test_split(X, y, random_state=1)
automl = autosklearn.classification.AutoSklearnClassifier(
time_left_for_this_task=SECONDS_PER_DATASET,
per_run_time_limit=SECONDS_PER_MODEL,
scoring_functions =[autosklearn.metrics.roc_auc]
)
automl.fit(X, y)
return automl