(체험 제2유형)

안녕하세요 선생님..
이 문제에서
import pandas as pd
pd.set_option('display.max_column',None)
pd.set_option('display.float_format',"{:.10f}".format)
train = pd.read_csv("data/customer_train.csv")
test = pd.read_csv("data/customer_test.csv")
# print(train.shape, test.shape) # 3500,11 / 2482 ,10개
# print(train.isnull().sum()) # 환불금액 결측치 있음 2295
train = train.fillna(0)
test = train.fillna(0)
# print(train.isnull().sum()) 결측치 제거완료
# print(train.head())
# print(train.info()) # 주 구매상품, 주 구매지점
# print(train.describe(include='object')) # 유니크가 42개, 24개라서 라벨인코더 가야할듯
# cols = train.select_dtypes(inclued='object').coulmns !!!!
# print(train.head())
cols = ['주구매상품', '주구매지점']
# print(train['주구매상품'].nunique())
# print(test['주구매상품'].nunique())
# print(train.describe(include='O'))
# print(test.describe(include='O'))
from sklearn.preprocessing import LabelEncoder
for col in cols :
le = LabelEncoder()
train[col] = le.fit_transform(train[col])
test[col] = le.transform(test[col])
# print(train.shape, test.shape)
# print(train.head())
target = train.pop('성별')
# print(target)
from sklearn.model_selection import train_test_split
X_tr,X_val,y_tr,y_val = train_test_split(train,target,test_size=0.2)
# print(X_tr.shape, X_val.shape, y_tr.shape, y_val.shape) # 2800
from sklearn.metrics import roc_auc_score
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier()
rf.fit(X_tr,y_tr)
pred = rf.predict_proba(test) <---- 실행했는데
여기를 실행하면
ValueError: X has 11 features, but DecisionTreeClassifier is expecting 10 features as input.
가 발생합니다.. 대체 왜 그럴까요 ㅠㅠ??
뒤로가기 버튼 같은 것이 있나요?
0
22
1
강의 연장 문의
0
18
1
출력값 질문
0
28
2
수업노트가 어디에 있나요?
0
28
1
실기시험 제출관련
0
159
2
6.20 작업형 2 과적합
0
165
3
코딩팡 장업형2 베이스 라인 인코딩 종류 질문
0
51
2
로지스틱회귀, 회귀
0
51
2
회귀 문제를 풀때 질문입니다.
0
58
1
불균형 처리 후 성능이 더 낮아졌다면,
0
65
2
실기 체험 제2유형 에러 문의
0
65
1
LIGHTGBM 으로 하면 pred값이 소수점 6자리까지 나오는게 맞나요
0
51
2
3번문제 등분산 가정
0
49
2
작업형3 target 형 변환 질문
0
37
2
[작업형1] 연습문제 섹션1 ~ 10 의 section4
0
39
3
원핫인코딩과 레이블 인코딩에서 concat
0
60
2
제2유형 질문입니다.
0
48
2
C()
0
44
2
작업형 2에서 strafity 적용 유무
0
52
2
수강 기간 연장 가능 여부 문의드립니다.
0
61
1
ols
0
44
2
2유형 작성관련 질문(일반 심화)
0
40
2
2유형 작성관련 질문
0
41
2
2유형 object컬럼 개수 다르면
0
48
2





