【发布时间】:2021-07-15 23:26:13
【问题描述】:
我在 scikitlearn 中有一个带有 Tfidf 矢量化器和逻辑回归的模型管道。
我正在尝试对我的文本 (NLP) 使用 eli5.show_prediction 函数。
## Rand is just a random integer , and feat_ns is the list of all of my features.##
## X_test is from my test/train split##
## Yes the brackets around X_test[rand] are funky but this is what the function asked for##
eli5.show_prediction(pipeline.named_steps['logr'], doc= [[X_test[rand]]],top=30, feature_names = feat_ns)
Error: X has 1 features per sample; expecting 13791
【问题讨论】:
标签: python pandas scikit-learn eli5