日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

sklearn svm

發布時間:2025/3/21 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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的全部內容,希望文章能夠幫你解決所遇到的問題。

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