기본 콘텐츠로 건너뛰기

라벨이 재현율Recall인 게시물 표시

[matplotlib]quiver()함수

[ML]이진 분류(Binary Classification): SGDClassifier

이진분류(Binary Classification): SGDClassifier 내용 SGDClassifier 모형평가:교차검증(Cross-Validation) import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_style("darkgrid") SGDClassifier 다음은 make_classification() 함수를 사용하여 2개의 특징과 2개의 클래스로 구성된 라벨인 데이터를 생성한것입니다. from sklearn.datasets import make_classification X,y=make_classification(n_samples=1000, n_features=2,n_informative=1,n_redundant=0, n_clusters_per_class=1, random_state=1) X.shape, y.shape ((1000, 2), (1000,)) ytr[:10] array([0, 0, 0, 0, 1, 0, 1, 0, 0, 0]) 위 데이터를 모델 생성을 위한 훈련데이터와 모델 검정을 위한 검정데이터로 구분하였습니다. from sklearn.model_selection import train_test_split Xtr, Xte, ytr, yte=train_test_split(X, y, test_size=0.3, random_state=2) 이진 분류기를 생성하기 위해 SGDClassifier() 클래스를 사용합니다. 확률적 경사하강법(Stochastic Gradient Descent)을 적용한 정규화된 선형 분류모델( 경사하강법 참조) 계산값 < 0 &rightarr; 0(Negative) 계산값 > 0 &rightarr; 1(Positive) from sklearn.linear_model i...