transact.py 文件源码

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

项目:banking-class 作者: eli-goodfriend 项目源码 文件源码
def run_test(train_in, train_out, test_in, test_out, modelname, embeddings, run_parse=True,
             model_type='logreg',C=10.0,
             alpha=1.0, cutoff=0.50, n_iter=1):  
    # test performance of model against a hand classified test set
    # running the parser takes most of the time right now, so option to shut it off
    run_cat(train_in,modelname,train_out,embeddings,new_run=True,run_parse=run_parse,
            model_type=model_type,C=C,
            alpha=alpha, cutoff=cutoff, n_iter=n_iter)

    run_cat(test_in,modelname,test_out,embeddings,new_run=False,
            model_type=model_type,C=C,
            alpha=alpha, cutoff=cutoff, n_iter=n_iter)

    testData = pd.read_csv(test_out)
    precision = metrics.precision_score(testData.truth, testData.category, average='weighted')
    print "Overall precision is " + str(precision*100.) + "%"

    return precision
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号