knock74.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:100knock2016 作者: tmu-nlp 项目源码 文件源码
def main():
    lr = joblib.load('./lr.pkl')
    dic2vec = DictVectorizer()
    features = list()
    y = list()
    for line in open('sentiment.txt'):
        word_list = line[3:].strip('\n').strip().split()
        features.append(getFeature(word_list))
    x = dic2vec.fit_transform(features)
    with open('sentiment_prediction.txt', 'w') as fp:
        for sentiment, prob in zip(lr.predict(x), lr.predict_proba(x)):
            print('{}\t{}'.format(sentiment, prob), file=fp)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号