EpistasisLab / EpistasisLab/tpot
How to avoid TPOT using StackingEstimator or any built in estimator?
- Dominant language
- Jupyter Notebook
- Stars
- 10.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
[I'm running TPOT for get some good ideas for a pipeline on a classification task, but always I fit a model the best pipeline is chosen from a StackingEstimator which I do not want to use since I need to use only sklearn models]
How can I achieve this?
```Python
# %load tpot_pipeline.py
import numpy as np
import pandas as pd
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline, make_union
from sklearn.svm import LinearSVC
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=None)
# Average CV score on the training set was:0.8024242424242424
exported_pipeline = make_pipeline(
StackingEstimator(estimator=LinearSVC(C=1.0, dual=False, loss="squared_hinge", penalty="l2", tol=0.001)),
ExtraTreesClassifier(bootstrap=False, criterion="entropy", max_features=0.45, min_samples_leaf=3, min_samples_split=9, n_estimators=100)
)
exported_pipeline.fit(training_features, training_target)
results = exported_pipeline.predict(testing_features)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.