무던히 하다보면 느는

[파이썬/Python] 파이프라인(2) 본문

파이썬

[파이썬/Python] 파이프라인(2)

무던히 하다보면 느는 2022. 7. 12. 00:50
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC

pipe_svc = Pipeline([('scl', StandardScaler()), ('clf', SVC(random_state=1))])

param_range = [0.03,0.05,10]
param_grid = [
    {'clf__C': param_range, 'clf__kernel': ['linear']},
    {'clf__C': param_range, 'clf__gamma': param_range, 'clf__kernel': ['rbf']}]

gs = GridSearchCV(estimator=pipe_svc, param_grid=param_grid,
                  scoring='accuracy', cv=10, n_jobs=1)
%time gs = gs.fit(X_train, y_train)

앞 파이프라인과 비교하여 커널이 linear와 rbf, 민맥스에서 스탠다드로 cv도 10으로 .,

 

CPU times: user 10min 4s, sys: 2.43 s, total: 10min 7s Wall time: 10min 5s

 

https://datascienceschool.net/03%20machine%20learning/14.01%20%EB%AA%A8%ED%98%95%20%EC%B5%9C%EC%A0%81%ED%99%94.html

 

모형 최적화 — 데이터 사이언스 스쿨

.ipynb .pdf to have style consistency -->

datascienceschool.net

 

'파이썬' 카테고리의 다른 글

[파이썬/Python]  (0) 2022.07.12
[파이썬/Python]  (0) 2022.07.12
[파이썬/Python] 파이프라인  (0) 2022.07.12
[파이썬/Python] 리샘플링 (Resampling)  (0) 2022.07.10
[파이썬/Python] numpy array와 list 차이점  (0) 2022.07.10