더북(TheBook)

이 개념은 규제와 관련이 있습니다. 규제가 있는 로지스틱 회귀 모델을 다룬 이전 절에서 언급했듯이 C 값을 줄이면 편향(과소적합)이 늘고 모델 분산(과대적합)이 줄어듭니다.

이제 선형 SVM에 대한 기본 개념을 배웠습니다. 붓꽃 데이터셋의 꽃 분류 문제에 SVM 모델을 훈련해 보죠.

>>> from sklearn.svm import SVC
>>> svm = SVC(kernel='linear', C=1.0, random_state=1)
>>> svm.fit(X_train_std, y_train)
>>> plot_decision_regions(X_combined_std,
...                       y_combined,
...                       classifier=svm,
...                       test_idx=range(105, 150))
>>> plt.xlabel('Petal length [standardized]')
>>> plt.ylabel('Petal width [standardized]')
>>> plt.legend(loc='upper left')
>>> plt.tight_layout()
>>> plt.show()
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.