我在做华盛顿大学的作业,我要用逻辑回归中的decision_function()来预测样本检验矩阵(最后几行)的分数。但我得到的错误是
ValueError: X has 145 features per sample; expecting 113092
代码如下:
^{pr2}$以下是产品数据:
Name Review Rating
0 Planetwise Flannel Wipes These flannel wipes are OK, but in my opinion ... 3
1 Planetwise Wipe Pouch it came early and was not disappointed. i love... 5
2 Annas Dream Full Quilt with 2 Shams Very soft and comfortable and warmer than it l... 5
3 Stop Pacifier Sucking without tears with Thumb... This is a product well worth the purchase. I ... 5
4 Stop Pacifier Sucking without tears with Thumb... All of my kids have cried non-stop when I trie... 5
此行导致后续行出错:
将上述内容改为:
^{pr2}$解释:将使用转换函数对数据进行拟合。因此,所有关于训练数据的信息都会丢失,词汇表只能从测试数据中计算出来。在
{{cd2>你要用这个对象来转换。因此,其中的特性将仅是从
test_data
中学到的那些特性。在但是
sentiment_model
是从train_data
开始训练词汇的。因此,这些特征是不同的。在总是在测试数据上使用
transform()
,而不是fit_transform()
。在相关问题 更多 >
编程相关推荐