簡體   English   中英

使用MLP的神經網絡分類器

[英]Neural network classifier using MLP

我是機器學習的新手,我正在研究一個python應用程序,該應用程序使用II將發布摘要的數據集對撲克手進行分類。 它似乎運行不佳。 它無法正確分類手。 我收到以下錯誤

", line 298, in fit
    raise ValueError("Multioutput target data is not supported with "
ValueError: Multioutput target data is not supported with label binarization

以下是我的代碼:

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])

以下是我正在使用的數據集的示例: 此處的圖像

這是數據集的描述: https : //archive.ics.uci.edu/ml/datasets/Poker+Hand

有什么不對? 我確實希望有人以正確的方式指導我。

只是為了在這里保留答案。

問題是scalet.fit必須包含Y_train

更改:

scaler.fit(X_train)

至:

scaler.fit(X_train, y_train)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM