EpistasisLab / EpistasisLab/tpot

feature mismatch

Open
#1,216 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
10.1k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

I used `tpot==0.11.7` to train my model

code flow:-

```
from tpot import TPOTClassifier
from sklearn.metrics import classification_report

pipeline_optimizer = TPOTClassifier(generations=5, population_size=50, cv=5,
random_state=42, verbosity=2, scoring='f1')

pipeline_optimizer.fit(X_train, y_train)

predictions = pipeline_optimizer.predict(X_test)
print(classification_report(y_test, predictions))

#extracted the best model
exctracted_best_model = pipeline_optimizer.fitted_pipeline_.steps[-1][1]
```

> reference(https://stackoverflow.com/questions/57369927/getting-feature-importances-after-getting-optimal-tpot-pipeline)

now when i am running this `exctracted_best_model` on x_test
`test_results = exctracted_best_model.predict(X_test)`

it says `ValueError: Number of features of the model must match the input. Model n_features is 418 and input n_features is 417`

X_test only has 417 features how can the model train on more than that?
is `exctracted_best_model = pipeline_optimizer.fitted_pipeline_.steps[-1][1]` not the right way to get best model from tpot ?
can i straight away dump `pipeline_optimizer` as pickle object and get the best model till now ?

Also how do you recreate the below in sklearn ?

`Best pipeline: DecisionTreeClassifier(LinearSVC(input_matrix, C=10.0, dual=False, loss=squared_hinge, penalty=l1, tol=0.1), criterion=gini, max_depth=10, min_samples_leaf=14, min_samples_split=7)`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.