标签:cloud libs ccf tle 回归 空间 分类器 mod 距离
12345678910111213
from sklearn.model_selection import train_test_splitfrom sklearn.svm import SVCX = df_featy = cancer['target']X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)model = SVC()model.fit(X_train, y_train)pred = model.predict(X_test)from sklearn.metrics import classification_report, confusion_matrixprint(classification_report(y_test, pred))print(confusion_matrix(y_test, pred))
1234567891011121314
from sklearn.model_selection import train_test_splitfrom sklearn.svm import SVCfrom sklearn.model_selection import GridSearchCVparam_grid = {'C': [0.1, 1, 10, 100, 1000], 'gamma': [1, 0.1, 0.01, 0.001, 0.0001]}grid = GridSearchCV(SVC(), param_grid, verbose=3)grid.fit(X_train, y_train)grid.best_params_grid.best_estimator_grid_pred = grid.predict(X_test)print(classification_report(y_test, grid_pred))print(confusion_matrix(y_test, grid_pred))
支持向量机 SVM - Wenjing
原文地址:https://www.cnblogs.com/lijianming180/p/12041121.html