Python 튜토리얼

기초

  • moneyIcon Prize : 교육
  • 9,999명 D-100719

 

Lv4 튜닝 6/6 python 파이썬 모델 튜닝 / Voting Classifier(2)

2021.09.03 15:41 2,094 Views

안녕하세요.👩‍🔧👨‍🔧 지난시간에는 모델의 파라미터를 튜닝하고, 튜닝 된 모델을 Voting Claasifier로 정의 했습니다.

이번시간에는 Voting Classifier을 이용해 train 데이터를 학습하고 test 데이터 셋을 예측 해보겠습니다.


그럼 바로 실습을 진행해보도록 하겠습니다. 🕵️‍♂️


-------------------------------------------------------------------------------------------------------------------------------------------------------------

# 모델 정의 (튜닝된 파라미터로)

LGBM = LGBMClassifier(max_depth = 2,n_estimators=60, subsample = 0.8229)

XGB = XGBClassifier(gamma =  4.376, max_depth = 3, subsample = 0.9818)

RF = RandomForestClassifier(max_depth = 3, n_estimators = 35)


# VotingClassifier 정의

VC = VotingClassifier(estimators=[('rf',RF),('xgb',XGB),('lgbm',LGBM)],voting = 'soft')


X = train_one.drop('quality',axis= 1)

y = train_one['quality']




# fit 메소드를 이용해 모델 학습

VC.fit(X,y)


# predict 메소드와 test_one 데이터를 이용해 품질 예측

pred = VC.predict(test_one)


# sample_submission.csv 파일을 불러와 예측된 값으로 채워 주기

submission = pd.read_csv('data/sample_submission.csv')

submission['quality'] = pred

submission.head()


submission.to_csv('tune_voting.csv',index=False)

-------------------------------------------------------------------------------------------------------------------------------------------------------------

[Colab 실습 링크]


↩️ 오늘의 파이썬 리스트

#데이콘_101 #AI #머신러닝 #딥러닝 #파이썬 #파이선  #데이터분석 #데이터사이언티스트 #코랩 #Python  #colab #kaggle #pandas #numpy #sckit-learn # read_csv #Bayesian #Optimization #bayesianoptimization #베이지안옵최적화


로그인이 필요합니다
0 / 1000
그린티
2021.09.13 21:43

done

왼쪽눈썹왁싱
2021.11.02 15:49

changhyeon
2022.01.03 17:54

done

dbnoid
2022.01.19 10:14

hijihyo
2022.01.29 19:34

Kdata
2022.05.04 14:59

krooner
2022.05.20 00:12

dirno
2022.08.02 15:54

highllight
2023.02.12 22:41

DACON.NPC
2023.02.17 11:57

DACON.NPC
2023.02.17 11:58

DACON.NPC
2023.02.17 11:58

이전 글
인덱싱을 위한 Pandas .iloc .loc 사용 방법 데이터 분석 및 조작을위한
Competition - Python 튜토리얼
Likes 4
Views 1,710
Comments 0
일 년 전
현재 글
Lv4 튜닝 6/6 python 파이썬 모델 튜닝 / Voting Classifier(2)
Competition - Python 튜토리얼
Likes 9
Views 2,094
Comments 12
3년 전
다음 글
다음 글이 존재하지 않습니다.