inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

섹션7. 모의고사 풀어보기 2 질문있습니다.

해결된 질문

588

james3710

작성한 질문수 4

0

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))

python 머신러닝 빅데이터 pandas 빅데이터분석기사

답변 1

0

퇴근후딴짓

xgb가 예민하게 워닝을 발생하더라고요 !

새소식에 lightGBM 사용 방법 안내와 lightGBM 뽀너스 영상을 추가했습니다.

부스팅계열이면서 xgb보다 속도가 빠른 lightgbm을 추천해요!

강의 연장 관련하여 문의드립니다.

0

16

1

섹션7 자료 다운로드

0

16

2

작업형 1 연습문제 Section12

0

15

2

수강기간 연장 문의

0

27

1

안녕하세요, 혹시 수강기간 연장이 가능할까요?

0

27

2

판다스 강의자료는 어디서 받을 수 있나요?

0

26

2

작업형2 모의고사3 자료 업데이트 요청

0

33

4

수강 연장가능여부 문의드립니다!

0

38

2

수강기간 연장 문의드립니다!

0

35

2

최빈값

0

32

2

수강 가이드라인

0

29

2

수강 연장 가능 여부 문의

0

55

2

강의 구매했는데 교재 필수일까요

0

43

2

수강기간 연장 가부 문의드립니다.

0

40

2

수강기간 연장이 가능한지 양해를 구하며 문의를 드립니다.

0

42

2

작업형2 모의문제2에서 drop이랑 인코딩

0

51

3

인코딩을 다 꼭 해봐야하는지

0

51

2

안녕하세요? 강사님 질문있습니다.(인코딩관련)

0

62

2

이진분류에서 양성 클래스가 0일 때 평가 방법

0

46

2

원핫인코딩 전 train과 test 병합여부

0

51

2

수강기간 연장

0

72

2

29강 작업2형의 이상치 처리

0

70

2

수강기간 연장 문의드립니다!

0

66

2

9월에 실기출제기준 개정내역에 신설된부분

0

56

1