-
Notifications
You must be signed in to change notification settings - Fork 0
/
529_pollen_pipeline.py
22 lines (19 loc) · 1.08 KB
/
529_pollen_pipeline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline, make_union
from sklearn.svm import LinearSVR
from tpot.builtins import StackingEstimator
from xgboost import XGBRegressor
# 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:-2.0615231327022974
exported_pipeline = make_pipeline(
StackingEstimator(estimator=XGBRegressor(learning_rate=0.001, max_depth=6, min_child_weight=13, n_estimators=100, nthread=1, subsample=0.9000000000000001)),
LinearSVR(C=0.01, dual=True, epsilon=0.1, loss="squared_epsilon_insensitive", tol=0.1)
)
exported_pipeline.fit(training_features, training_target)
results = exported_pipeline.predict(testing_features)