lr.py 文件源码

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

项目:2016CCF-unicom 作者: xuguanggen 项目源码 文件源码
def run():
    tr_data = np.loadtxt('../new/TRAIN_LRFORMAT.txt')
    te_data = np.loadtxt('../new/TEST_LRFORMAT.txt')

    tr_x = tr_data[:,1:]
    tr_y = tr_data[:,0]
    te_x = te_data[:,1:]

    lr = LogisticRegression(
            solver='liblinear',
            multi_class='ovr',
            class_weight='balanced',
            penalty='l2',
            n_jobs=-1)
    #te_pred = lr.predict_proba(te_x)
    cv = 10
    scores = cross_val_score(lr,tr_x,tr_y,cv=cv,scoring='accuracy')
    print(str(scores))
    #np.savetxt('result/te_lr.txt',te_pred)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号