반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- web 개발
- postorder
- cudnn
- 데이터전문기관
- pycharm
- vscode
- html
- paragraph
- broscoding
- discrete_scatter
- 머신러닝
- inorder
- 대이터
- CES 2O21 참가
- mglearn
- web 사진
- bccard
- CES 2O21 참여
- C언어
- tensorflow
- classification
- 재귀함수
- java역사
- 자료구조
- web
- Keras
- KNeighborsClassifier
- web 용어
- 결합전문기관
- 웹 용어
Archives
- Today
- Total
bro's coding
sklearn.cross_val_score.models 본문
반응형
from sklearn.datasets import load_breast_cancer
cancer=load_breast_cancer()
score=[]
from sklearn.model_selection import cross_val_score
from sklearn.neighbors import KNeighborsClassifier
model=KNeighborsClassifier()
scores=cross_val_score(model,cancer.data,cancer.target)
score.append(scores.mean())
from sklearn.linear_model import LogisticRegression
model=LogisticRegression()
scores=cross_val_score(model,cancer.data,cancer.target)
score.append(scores.mean())
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
model=SVC()
# SVC는 normalization이 필요
ss=StandardScaler()
ss.fit(cancer.data)
X=ss.transform(cancer.data)
scores=cross_val_score(model,X,cancer.target)
score.append(scores.mean())
from sklearn.tree import DecisionTreeClassifier
model=DecisionTreeClassifier()
scores=cross_val_score(model,cancer.data,cancer.target)
score.append(scores.mean())
label=['KNeighborsClassifier','LogisticRegression','SVC','DecisionTreeClassifier']
plt.plot(score)
plt.xticks(range(4),label,rotation=60)
plt.hlines(np.mean(score),0,3,linestyles=':')
반응형
'[AI] > python.sklearn' 카테고리의 다른 글
sklearn.pipeline.Pipeline (0) | 2020.04.27 |
---|---|
sklearn.precision,recall (0) | 2020.04.24 |
sklearn.metrics.confusion_matrix(판정표) (0) | 2020.04.24 |
sklearn.model_selection.cross_val_score.LeaveOneOut (0) | 2020.04.24 |
sklearn.model_selection.cross_val_score.StratifiedKFold (0) | 2020.04.24 |
sklearn.model_selection.cross_val_score.KFold (0) | 2020.04.24 |
sklearn.model_selection.cross_val_score (0) | 2020.04.24 |
sklearn.manifold. TSNE (0) | 2020.04.23 |
Comments