섹션7. 모의고사 풀어보기 2 질문있습니다.
goorm을 써서 코드를 실행해보는데
데이터 분석하는 과정에서 랜덤 포레스트를 쓸 때는 warning 메시지가 하나도 안 나왔는데 한번 XGBoost를 사용하니까 바로
WARNING: ../src/learner.cc:1095: Starting in XGBoost 1.3.0, the default evaluation metric used with the objective 'binary:logistic' was changed from 'error' to 'logloss'. Explicitly set eval_metric if you'd like to restore the old behavior.
0.9724770642201834
/usr/local/lib/python3.9/dist-packages/xgboost/compat.py:31: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.
from pandas import MultiIndex, Int64Index
/usr/local/lib/python3.9/dist-packages/xgboost/sklearn.py:1146: UserWarning: The use of label encoder in XGBClassifier is deprecated and will be removed in a future release. To remove this warning, do the following: 1) Pass option use_label_encoder=False when constructing XGBClassifier object; and 2) Encode your labels (y) as integers starting with 0, i.e. 0, 1, 2, ..., [num_class - 1].
warnings.warn(label_encoder_deprecation_msg, UserWarning)
/usr/local/lib/python3.9/dist-packages/xgboost/data.py:208: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.
from pandas import MultiIndex, Int64Index
이런 워닝 코드가 뜹니다. 어떤 것이 문제일까요?
코드는 아래에 있습니다.
import pandas as pd
pd.set_option('display.max_columns',None)
train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
# 사용자 코딩
# print(train.head())
# print(train.describe())
from sklearn.model_selection import train_test_split
X_tr,X_val,y_tr,y_val = train_test_split(train.drop('target',axis=1), train['target'],
test_size=0.2, random_state=2022)
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(random_state=2022, max_depth=5, n_estimators=400)
rf.fit(X_tr,y_tr)
pred = rf.predict(X_val)
from xgboost import XGBClassifier
xgb = XGBClassifier(random_state=2022, max_depth=5, n_estimators=400, learning_rate=0.01)
xgb.fit(X_tr,y_tr)
pred = xgb.predict(X_val)
from sklearn.metrics import f1_score
print(f1_score(y_val,pred))
답변 1
0
xgb가 예민하게 워닝을 발생하더라고요 !
새소식에 lightGBM 사용 방법 안내와 lightGBM 뽀너스 영상을 추가했습니다.
부스팅계열이면서 xgb보다 속도가 빠른 lightgbm을 추천해요!
출력값 질문
0
12
1
수업노트가 어디에 있나요?
0
21
1
실기시험 제출관련
0
154
2
6.20 작업형 2 과적합
0
158
3
코딩팡 장업형2 베이스 라인 인코딩 종류 질문
0
50
2
로지스틱회귀, 회귀
0
48
2
회귀 문제를 풀때 질문입니다.
0
56
1
불균형 처리 후 성능이 더 낮아졌다면,
0
62
2
실기 체험 제2유형 에러 문의
0
61
1
LIGHTGBM 으로 하면 pred값이 소수점 6자리까지 나오는게 맞나요
0
50
2
3번문제 등분산 가정
0
48
2
작업형3 target 형 변환 질문
0
35
2
[작업형1] 연습문제 섹션1 ~ 10 의 section4
0
36
3
원핫인코딩과 레이블 인코딩에서 concat
0
59
2
제2유형 질문입니다.
0
46
2
C()
0
44
2
작업형 2에서 strafity 적용 유무
0
52
2
수강 기간 연장 가능 여부 문의드립니다.
0
61
1
ols
0
43
2
2유형 작성관련 질문(일반 심화)
0
39
2
2유형 작성관련 질문
0
41
2
2유형 object컬럼 개수 다르면
0
48
2
코딩팡질문이요ㅠㅠ
0
45
2
관찰값과 기대값의 개념이 헷갈립니다.
0
25
2





