기출유형 6회 작업형 2번 질문입니다..!
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요
먼저 유사한 질문이 있었는지 검색해보세요
안녕하십니까 오늘도 문제를 풀어보고 있는 와중에
마지막 부분에서 TypeError: 'dict' object is not callable
가 뜨네요 위치는 아래 처럼 46번에서 나오네요
문제가 무엇일까요...?
TypeError Traceback (most recent call last)
<ipython-input-101-9bd54b1c48b7> in <cell line: 46>()
44
45 pre = rf.predict(e_test)
---> 46 sm = pd.DataFrame({
47 'pred' : pre
48 })
import pandas as pd
e_train = pd.read_csv('energy_train.csv')
e_test = pd.read_csv('energy_test.csv')
pd.set_option('display.max_columns',None)
# print(e_train.info())
# print(e_train.shape, e_test.shape) (537, 10) (231, 9)
# print(e_test.isnull().sum()) 결측치는 X
#
# e_train.nunique() # 12 12 7 4 2 4 4 6 467(217) 5
hl = e_train.pop('Heat_Load')
c_tr = e_train.select_dtypes(exclude='O').columns
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
cols = c_tr
e_train[cols] = scaler.fit_transform(e_train[cols])
e_test[cols] = scaler.transform(e_test[cols])
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
col = ['Roof', 'Height', 'Orient']
for c in col :
e_train[c] = le.fit_transform(e_train[c])
e_test[c] = le.transform(e_test[c])
from sklearn.model_selection import train_test_split
X_tr, X_val, y_tr, y_val = train_test_split(
e_train,hl,test_size=0.1,random_state=2023
)
# print(X_tr.shape,X_val.shape,y_tr.shape,y_val.shape)
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import f1_score
rf = RandomForestClassifier()
rf.fit(X_tr,y_tr)
pred = rf.predict(X_val)
f1_score(y_val, pred, average='macro')
pre = rf.predict(e_test)
sm = pd.DataFrame({
'pred' : pre
})
sm.to_csv('result.csv', index=False)
답변 1
수업노트가 어디에 있나요?
0
17
1
실기시험 제출관련
0
148
2
6.20 작업형 2 과적합
0
156
3
코딩팡 장업형2 베이스 라인 인코딩 종류 질문
0
48
2
로지스틱회귀, 회귀
0
47
2
회귀 문제를 풀때 질문입니다.
0
54
1
불균형 처리 후 성능이 더 낮아졌다면,
0
61
2
실기 체험 제2유형 에러 문의
0
61
1
LIGHTGBM 으로 하면 pred값이 소수점 6자리까지 나오는게 맞나요
0
49
2
3번문제 등분산 가정
0
47
2
작업형3 target 형 변환 질문
0
34
2
[작업형1] 연습문제 섹션1 ~ 10 의 section4
0
36
3
원핫인코딩과 레이블 인코딩에서 concat
0
58
2
제2유형 질문입니다.
0
46
2
C()
0
44
2
작업형 2에서 strafity 적용 유무
0
51
2
수강 기간 연장 가능 여부 문의드립니다.
0
60
1
ols
0
43
2
2유형 작성관련 질문(일반 심화)
0
39
2
2유형 작성관련 질문
0
41
2
2유형 object컬럼 개수 다르면
0
48
2
코딩팡질문이요ㅠㅠ
0
45
2
관찰값과 기대값의 개념이 헷갈립니다.
0
25
2
작업형2 ID 컬럼 삭제 질문
0
45
2





