zl程序教程

您现在的位置是:首页 >  云平台

当前栏目

ML之SVM:利用SVM算法对手写数字图片识别数据集(PCA降维处理)进行预测并评估模型(两种算法)性能

识别算法性能数据 处理 利用 进行 模型
2023-09-14 09:04:45 时间

ML之SVM:利用SVM算法对手写数字图片识别数据集(PCA降维处理)进行预测并评估模型(两种算法)性能

 

 

 

 

目录

输出结果

设计思路

核心代码


 

 

 

 

 

 

输出结果

 

设计思路

 

核心代码


estimator = PCA(n_components=20)   
pca_X_train = estimator.fit_transform(X_train) 
pca_X_test = estimator.transform(X_test)      

pca_svc = LinearSVC()
pca_svc.fit(pca_X_train, y_train)
pca_y_predict = pca_svc.predict(pca_X_test)
svc.score(X_test, y_test)
classification_report(y_test, y_predict, target_names=np.arange(10).astype(str))

pca_svc.score(pca_X_test, y_test)
classification_report(y_test, pca_y_predict, target_names=np.arange(10).astype(str))