日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

sklearn svm

發布時間:2025/3/21 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 sklearn svm 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import numpy as np 復制代碼/anaconda3/envs/py35/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88return f(*args, **kwds) 復制代碼 data = pd.read_csv("credit-a.csv", header=None) 復制代碼data.head(2) 復制代碼 012345678910111213141501
030.830.0000901.25001102020.0-1
158.674.4600813.040061043560.0-1
from sklearn.model_selection import train_test_split 復制代碼x = data[data.columns[:-1]] 復制代碼y = data[15].replace(-1, 0) 復制代碼x_train, x_test, y_train, y_test = train_test_split(x, y) 復制代碼from sklearn import preprocessing 復制代碼scaler = preprocessing.StandardScaler().fit(x_train) x_train = scaler.transform(x_train) x_test = scaler.transform(x_test) 復制代碼from sklearn.svm import SVC 復制代碼/anaconda3/envs/py35/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88return f(*args, **kwds) 復制代碼 model = SVC(kernel='poly', degree=3, C=5) 復制代碼model.fit(x_train, y_train) 復制代碼SVC(C=5, cache_size=200, class_weight=None, coef0=0.0,decision_function_shape='ovr', degree=3, gamma='auto', kernel='poly',max_iter=-1, probability=False, random_state=None, shrinking=True,tol=0.001, verbose=False) 復制代碼 model.score(x_test, y_test) 復制代碼0.8597560975609756 復制代碼 model2 = SVC(kernel='rbf', gamma=0.5, C=5) 復制代碼model2.fit(x_train, y_train) 復制代碼SVC(C=5, cache_size=200, class_weight=None, coef0=0.0,decision_function_shape='ovr', degree=3, gamma=0.5, kernel='rbf',max_iter=-1, probability=False, random_state=None, shrinking=True,tol=0.001, verbose=False) 復制代碼 model2.score(x_test, y_test) 復制代碼0.8170731707317073 復制代碼

總結

以上是生活随笔為你收集整理的sklearn svm的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。