python - Logistic Regression Bigram Text Classification w/ Patsy -
i'm working on upgrading logisticregression text classification single word features bigrams (two word features). when include 2 word feature in formula sent patsy.dmatrices, receive following error...
y, x = dmatrices("is_host ~ dedicated + hosting + dedicated hosting", df, return_type="dataframe") file "<string>", line 1 dedicated hosting ^ syntaxerror: unexpected eof while parsing
i've looked around online examples on how approach , haven't found anything. tried throwing few different syntax options @ formula , none seem work.
"is_host ~ dedicated + hosting + {dedicated hosting}" "is_host ~ dedicated + hosting + (dedicated hosting)" "is_host ~ dedicated + hosting + [dedicated hosting]"
what proper way include multi-word features in formula passed dmatricies?
you want:
y, x = dmatrices("is_host ~ dedicated + hosting + q('dedicated hosting')", df, return_type="dataframe")
Comments
Post a Comment