inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

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

예시문제 작업형2 lgb 사용 관련 문의

해결된 질문

366

ycann

작성한 질문수 26

0

예시문제 작업형2를 시험환경에서 lgb 모델로 머신러닝을 실시하였는데, 'random_state' 파라미터 관련 경고 메세지가 뜨는데, lgb 모델에서는 'random_state' 를 사용할 수 없는 건가요?

[코딩내용]

import pandas as pd

X_test = pd.read_csv("data/X_test.csv")

X_train = pd.read_csv("data/X_train.csv")

y_train = pd.read_csv("data/y_train.csv")

pd.set_option('display.max_columns', 100)

pd.options.display.float_format = '{:.2f}'.format

# print(X_train.shape, X_test.shape, y_train.shape)

# print(X_train.head(3))

# print(X_test.head(3))

# print(X_train.info())

# print(X_train.describe())

# print(X_train.describe(include='object'))

# print(X_test.describe(include='object'))

# print(y_train.head(3))

# print(y_train['gender'].value_counts())

# print(X_train.isnull().sum())

# print(X_test.isnull().sum())

# print(y_train.isnull().sum())

# print(X_train['환불금액'].mean())

# print(X_test['환불금액'].mean())

X_train['환불금액'] = X_train['환불금액'].fillna(0)

X_test['환불금액'] = X_test['환불금액'].fillna(0)

# print(X_train.isnull().sum())

# print(X_test.isnull().sum())

X_train = X_train.drop('cust_id', axis=1)

X_test_id = X_test.pop('cust_id')

# print(X_test.head(3))

cols = X_train.select_dtypes(exclude='object').columns

# print(cols)

from sklearn.preprocessing import RobustScaler

scaler = RobustScaler()

X_train[cols] = scaler.fit_transform(X_train[cols])

X_test[cols] = scaler.transform(X_test[cols])

# print(X_train.head(3))

cols = X_train.select_dtypes(include='object').columns

# print(cols)

from sklearn.preprocessing import LabelEncoder

for col in cols :

le = LabelEncoder()

X_train[col] = le.fit_transform(X_train[col])

X_test[col] = le.transform(X_test[col])

# print(X_train.head(3))

from sklearn.model_selection import train_test_split

X_tr, X_val, y_tr, y_val = train_test_split(X_train, y_train['gender'], test_size=0.15, random_state=2022)

# print(X_tr.shape, X_val.shape, y_tr.shape, y_val.shape)

from sklearn.metrics import roc_auc_score

import lightgbm as lgb

model = lgb.LGBMClassifier(ramdom_state=2022, max_depth=5, n_estimators=600, learning_rate=0.01)

model.fit(X_tr, y_tr)

pred = model.predict_proba(X_val)

# print(pred[:10])

print(roc_auc_score(y_val, pred[ : , 1]))

# 0.6153810060060059

# max_depth=5 : 0.6353541041041042

# n_estimators=600, learning_rate=0.01 : 0.647366116116116

[경고 메세지]

[LightGBM] [Warning] Unknown parameter: ramdom_state

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

답변 1

0

퇴근후딴짓

제공합니다

image

ramdom_state=2022

앞 뒤에 눈에 보이지 않은 문자가 들어갔을 수도 있어 이 줄 전체 새로 한번 써주시겠어요? (복붙 말고요)

0

ycann

예, 처음부터 다시 작성하니까 이상이 없습니다.

시험에서 중간에 이런 경우가 발생하면 지우고 다시 작성을 해야 하는가요?

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

0

5

1

실기시험 제출관련

0

137

2

6.20 작업형 2 과적합

0

146

3

코딩팡 장업형2 베이스 라인 인코딩 종류 질문

0

47

2

로지스틱회귀, 회귀

0

47

2

회귀 문제를 풀때 질문입니다.

0

53

1

불균형 처리 후 성능이 더 낮아졌다면,

0

61

2

실기 체험 제2유형 에러 문의

0

60

1

LIGHTGBM 으로 하면 pred값이 소수점 6자리까지 나오는게 맞나요

0

47

2

3번문제 등분산 가정

0

46

2

작업형3 target 형 변환 질문

0

34

2

[작업형1] 연습문제 섹션1 ~ 10 의 section4

0

36

3

원핫인코딩과 레이블 인코딩에서 concat

0

57

2

제2유형 질문입니다.

0

46

2

C()

0

44

2

작업형 2에서 strafity 적용 유무

0

50

2

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

0

59

1

ols

0

43

2

2유형 작성관련 질문(일반 심화)

0

39

2

2유형 작성관련 질문

0

39

2

2유형 object컬럼 개수 다르면

0

48

2

코딩팡질문이요ㅠㅠ

0

45

2

관찰값과 기대값의 개념이 헷갈립니다.

0

25

2

작업형2 ID 컬럼 삭제 질문

0

45

2