【发布时间】:2015-08-13 10:44:00
【问题描述】:
我正在努力将 LogisticRegression 文本分类从单字特征升级为二元组(两个词特征)。但是,当我在发送到 patsy.dmatrices 的公式中包含两个单词特征时,我收到以下错误...
y, X = dmatrices("is_host ~ dedicated + hosting + dedicated hosting", df, return_type="dataframe")
File "<string>", line 1
dedicated hosting
^
SyntaxError: unexpected EOF while parsing
我在网上四处寻找有关如何解决此问题的任何示例,但没有找到任何东西。我尝试在公式中添加一些不同的语法选项,但似乎都没有。
"is_host ~ dedicated + hosting + {dedicated hosting}"
"is_host ~ dedicated + hosting + (dedicated hosting)"
"is_host ~ dedicated + hosting + [dedicated hosting]"
在传递给 dmatricies 的公式中包含多词特征的正确方法是什么?
【问题讨论】:
标签: python machine-learning scikit-learn logistic-regression patsy