728x90
from sklearn.linear_model import LogisticRegression / LinearRegression / BayesianRidge / Ridge / Lasso / ElasticNet
from sklearn.svm import SVC / SVR
from sklearn.neighbors import KNeighborsClassifier / KNeighborsRegressor
from sklearn.tree import DecisionTreeClassifier / DecisionTreeRegressor
from sklearn.neural_network import MLPClassifier / MLPRegressor
from sklearn.ensemble import RandomForestClassifier / RandomForestRegressor
VotingClassifier / VotingRegressor
BaggingClassifier / BaggingRegressor
StackingClassifier / StackingRegressor
AdaBoostClassifier
GradientBoostingClassifier
from sklearn.cluster import KMeans / DBSCAN
from sklearn.naive_bayes import GaussianNB
model = LogisticRegression() / LinearRegression() / BayesianRidge() / Ridge() / Lasso() / ElasticNet()
= SVC() / SVR(kernel='poly')
= KNeighborsClassifier(n_neighbors=n) / KNeighborsRegressor()
= DecisionTreeClassifier() / DecisionTreeRegressor()
= MLPClassifier() / MLPRegressor()
= RandomForestClassifier() / RandomForestRegressor()
= VotingClassifier(estimators=[...], voting='soft') / VotingRegressor(estimators=[...], voting='soft')
= BaggingClassifier() / BaggingRegressor()
= StackingClassifier() / StackingRegressor()
= AdaBoostClassifier()
= GradientBoostingClassifier()
= KMeans(n_cluster=k) / DBSCAN(...)
= GaussianNB()
model.fit(X_scaled_train, y_train)
pred_test = model.predict(X_scaled_test)
= model.predict_proba(X_scaled_test)
score = model.score(X_scaled_test, y_test)
# 교차검증
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
kfold = KFold(n_splits=n, shuffle=True, random_state=42)
score = cross_val_score(model, X_scaled_train, y_train, cv=kfold)
728x90
'IT자격증 > 빅데이터분석기사(실기)' 카테고리의 다른 글
[빅데이터분석기사 실기] 제2유형 (0) | 2022.06.15 |
---|---|
[빅데이터분석기사 실기] 제1유형 (0) | 2022.06.15 |
[빅데이터분석기사 실기] 결과 저장 (0) | 2022.05.30 |
[빅데이터분석기사 실기] 하이퍼파라미터 튜닝 및 해석 (0) | 2022.05.30 |
[빅데이터분석기사 실기] 데이터 분석 및 전처리 (0) | 2022.05.30 |