EpistasisLab / EpistasisLab/tpot

ValueError: Error: Input data is not in a valid format in TPOT classifier!

Open
#1,196 0 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

Hello, I had an issue with TPOT classifier. I have the following code:

#########################
tpot_data = pd.read_csv(path, dtype=np.float64)
tpot_data.fillna(0, inplace=True)
features = tpot_data.drop('class', axis=1).values
X_train, X_test, y_train, y_test = train_test_split(features, tpot_data['class'].values, test_size= 0.25, random_state=0)

tpot = TPOTClassifier(verbosity=2, scoring='accuracy', n_jobs=-1, max_time_mins=5,
early_stop=5, template='Selector-Transformer-Classifier')

tpot.fit(X_train, y_train)
y_hat = tpot.predict(X_test)
print(tpot.score(y_test, y_hat))
########################

The classifer crashes at the last generation (when scoring) and the output is:
"ValueError: Error: Input data is not in a valid format. Please confirm that the input data is scikit-learn compatible. For example, the features must be a 2-D array and target labels must be a 1-D array."

I tried rehsaping the input data but the same output each time. Then I used "accuracy_score" from sklearn.metrics and the issue is resolved!! 👍

I hope this helps!...Thanks.

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.