'''
今天学习到的东西,、
很重要
'''
#cross_validation
from sklearn import cross_validation
x_train,x_test,y_train,x_test=cross_validation.train_test_split(x,y,test_size=0.25,
random_state=0,stratify=y)
#学习器cl cross_validation k_fold检验
from sklearn.model_selection import cross_val_score
score=cross_val_score(cl,x,y,cv=10)
#展现混淆矩阵,以及最后结果报告
from sklearn import metrics
metrics.classification_report(y_expect,y_predict)
metrics.confusion_matrix(y_expect,y_predict)
#产生特征的高阶数
from sklearn.preprocessing import PolynomialFeatures
import numpy as np
data=np.arange(16).reshape(4,4)
new=PolynomialFeatures(degree=3,include_bias=False)
new_data=new.fit_transform(data)
sklean中交叉检验和混淆矩阵
最新推荐文章于 2024-01-18 16:51:40 发布