inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

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

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

해결된 질문

574

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

3

1

수강 신청 연장 문의드립니다.

0

15

1

작업형 1번문제... 환경관련

0

24

2

12회 기출은 언제 업데이트 될까요??

0

34

2

8/6 작성한 연장문의 질문글에 대한 재요청

0

36

2

수강기간 연장 문의

0

33

2

수강기간 연장문의

0

35

2

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

0

34

2

수강 기간 연장 문의

0

44

2

수강연장 가능 문의 (기간 약 한달반)

0

57

2

수강기간 연장 가능할까요 선생님

0

72

2

Section15. 수업에 사용하는 데이터 주소가 다 보이지 않아서 실습을 위한 데이터를 다운 받지 못하고 있습니다.

0

49

3

수강연장요청 문의

0

84

2

아무래도 다음 시험 연장은 어렵겠죠?

0

104

2

빅분기 12회 결과 관련 문의

0

110

1

책이랑 강의랑 순서나 예제가 다른것 같네요

0

79

2

수강연장 문의

0

102

2

재검토 요청 방법 좀 알려주셔요...-.-;;

0

102

2

12회 실기 질문(작업형 2)

0

89

2

뒤로가기 버튼 같은 것이 있나요?

0

63

1

강의 연장 문의

0

97

2

출력값 질문

0

69

2

수업노트가 어디에 있나요?

0

61

1

실기시험 제출관련

0

224

3