#逻辑回归
lr = LogisticRegressionCV(multi_class="ovr",fit_intercept=True,Cs=np.logspace(-2,2,20),cv=2,penalty="l2",solver="lbfgs",tol=0.01)
re = lr.fit(X_train,y_train)
r = re.score(X_train,y_train)
print("R值(准确率):",r)
print("参数:",re.coef_)
print("截距:",re.intercept_)
print("稀疏化特征比率:%.2f%%" %(np.mean(lr.coef_.ravel()==0)*100))
print("=========sigmoid函数转化的值,即:概率p=========")
print(re.predict_proba(X_test))
#对测试集做预测
y_predict = lr.predict(X_test)
#查看分类变量有哪些取值
y_test.unique()
#输出预测的结果
print ('精确率为:',lr.score(X_test,y_test))
print (classification_report(y_test,y_predict,target_names = ['0','1']))
#决策树
dtc = tree.DecisionTreeClassifier()
dtc.fit(X_train, y_train)
y_predict_dtc = dtc.predict(X_test)
#获取预测结果报告
print ('Accracy:',dtc.score(