TF IDF类别权重
Tf-Idf-CategoryWeighting的Python项目详细描述
tf idf类别权重
列车数据格式
Y_train | X_train |
---|---|
game | The LoL champions pro players would ban forever |
society | In Beijing you should keep the rules |
etc. | etc. |
示例用法
>>>importTfIdfCategoryWeighting#creat vectorizer>>>Tf_idf_cw_vectorizer=TfIdfCategoryWeighting.TfidfPro_Vectorizer(use_idf=True,use_Wt=True)#train vectorizer>>>Tf_idf_cw_vectorizer.fit(X_train,Y_train)#transform word to vector>>>X_train=Tf_idf_cw_vectorizer.transform(X_train)
安装
$ pip install Tf-Idf-CategoryWeighting