SVC(Support Vector Classification)
# 변수에 저장하여 사용
>>> classifier = SVC(kernel='linear')
>>> classifier = SVC(kernel='rbf')
# 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' 호출 가능
# default = 'rbf'
from sklearn.svm import SVC
>>> classifier = SVC() # 디폴트 값 'rbf'
>>> classifier.fit(X_train, y_train)
>>> y_pred = classifier.predict(X_test)
>>> y_pred
array([0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1,
1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1,
0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0,
1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], dtype=int64)
from sklearn.metrics import confusion_matrix, accuracy_score
>>> confusion_matrix(y_test, y_pred)
array([[49, 9],
[ 3, 39]], dtype=int64)
>>> accuracy_score(y_test, y_pred)
0.88
'인공지능 > Machine Learning' 카테고리의 다른 글
[Machine Learning] K- 평균 군집 K-Means Clustering (0) | 2024.04.16 |
---|---|
[Machine Learning] 분류 예측 Decision Tree (0) | 2024.04.15 |
[Machine Learning] 분류 예측 K-NN (0) | 2024.04.15 |
[Machine Learning] 성능 측정 confusion_matrix(), accuracy_score(), classification_report() (1) | 2024.04.15 |
[Machine Learning] 분류 예측 LogisticRegression (0) | 2024.04.15 |