-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen10_eng13_180125.py
26 lines (23 loc) · 1.33 KB
/
gen10_eng13_180125.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
import numpy as np
import pandas as pd
from sklearn.ensemble import ExtraTreesRegressor, RandomForestRegressor
from sklearn.linear_model import ElasticNetCV, RidgeCV
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline, make_union
from sklearn.preprocessing import RobustScaler
from tpot.builtins import StackingEstimator
# NOTE: Make sure that the class is labeled 'target' in the data file
tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64)
features = tpot_data.drop('target', axis=1).values
training_features, testing_features, training_target, testing_target = \
train_test_split(features, tpot_data['target'].values, random_state=42)
# Score on the training set was:-0.0004122473363683386
exported_pipeline = make_pipeline(
RobustScaler(),
StackingEstimator(estimator=RidgeCV()),
StackingEstimator(estimator=ElasticNetCV(l1_ratio=0.75, tol=1e-05)),
StackingEstimator(estimator=ExtraTreesRegressor(bootstrap=False, max_features=0.9500000000000001, min_samples_leaf=1, min_samples_split=7, n_estimators=100)),
RandomForestRegressor(bootstrap=False, max_features=0.25, min_samples_leaf=1, min_samples_split=9, n_estimators=100)
)
exported_pipeline.fit(training_features, training_target)
results = exported_pipeline.predict(testing_features)