I'm new to Machine Learning and I'm working on a python application that classifies an poker hands using a dataset which II will post snippets. It does not seem to work well. It cannot classify the hands correctly. And I am getting the following error
", line 298, in fit
raise ValueError("Multioutput target data is not supported with "
ValueError: Multioutput target data is not supported with label binarization
the following is my code:
import pandas as pnd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import classification_report
training = pnd.read_csv(".idea/train.csv")
training.keys()
training.shape
X = np.array(training)
y = np.array(training)
X_train, X_test, y_train, y_test = train_test_split(X, y)
scaler = StandardScaler()
# Fit only to the training data
scaler.fit(X_train)
X_train = scaler.transform(X_train)
X_test = scaler.transform(X_test)
mlp = MLPClassifier(hidden_layer_sizes=(30, 30, 30, 30, 30, 30, 30, 30, 30, 30))
mlp.fit(X_train, y_train)
predictions = mlp.predict(X_test)
print(classification_report(y_test, predictions))
len(mlp.coefs_)
len(mlp.coefs_[0])
len(mlp.intercepts_[0])
The following is a sample of the data set I am using: Image here
And here is a desciption of the data set: https://archive.ics.uci.edu/ml/datasets/Poker+Hand
Is there something wrong? I do hope someone could guide me if I'm doing things the right way.
Just to keep it as an answer here.
The problem is that scalet.fit
has to contain Y_train
.
Change:
scaler.fit(X_train)
to:
scaler.fit(X_train, y_train)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.