ValueError:X.shape[1]=96应等于2,即训练时的特征数

2024-10-02 02:25:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我在这里学习教程:https://scikit-learn.org/stable/auto_examples/miscellaneous/plot_multilabel.html#sphx-glr-auto-examples-miscellaneous-plot-multilabel-py

我有要分类的文本,所以我对它们进行了编码。在线上

classif = OneVsRestClassifier(SVC(kernel = 'linear'))
classif.fit(X, Y)

我的{}是(188,96),我的{}是(188,2)

当我尝试运行clf.predict(test)时,即使test是(56,96),我也会得到错误ValueError: X.shape[1] = 96 should be equal to 2, the number of features at training time。这两个功能是从哪里来的?MyY标签是2D数组,但MyX有96列


Tags: httpsorgtestautoplothtml教程scikit

热门问题