더미처리 후 model.fit() 에서 오류가 납니다.
755
2 asked
# 범주형 데이터의 카테고리
df_out['weather_code'] = df_out['weather_code'].astype('category')
df_out['season'] = df_out['season'].astype('category')
df_out['year'] = df_out['year'].astype('category')
df_out['month'] = df_out['month'].astype('category')
df_out['hour'] = df_out['hour'].astype('category')
df_out['dayofweek'] = df_out['dayofweek'].astype('category') # dayofweek 추가됨
# 더미처리
df_out = pd.get_dummies(df_out, columns=['weather_code','season','year','month','hour','dayofweek']) # dayofweek 추가됨
# 종속변수 'cnt', 독립변수('나머지 컬럼')을 분리하는 작업
df_y = df_out['cnt'] # 종속변수 Y
df_x = df_out.drop(['timestamp', 'cnt'], axis = 1) # 독립변수 X
# 훈련용, 테스트용 데이터 분리
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(df_x, df_y, random_state=66, test_size=0.3, shuffle=False) # 매번 동일한 래덤값을 고정하여 값 변경되지 않게, shuffle=False는 시계열 데이터 이므로
## .... 이후
model.compile(loss='mae', optimizer='adam', metrics=['mae'])
early_stopping = EarlyStopping(monitor='loss', patience=5, mode='min')
history = model.fit(x=x_train, y=y_train, epochs=50, batch_size=1, validation_split=0.1, callbacks=[early_stopping])
train 데이터 오류로 인해 딥러닝이 되지 않습니다.
선생님 강좌와 차이점은 dayofweek을 추가한 내용입니다.
왜? dayofweek을 카테고리 & 더미 처리를 하면 딥러닝이 되지 않는지? 궁금합니다.
Answer 1
0
model.add(Dense(units=160, activation='relu', input_dim=52))
이 코드에서 input_dim 에 입력한 값이 df_out.shape 을 봤을 때 열의 값과 동일한지 한번 체크해보세요!
import torch가 안되는 경우는 어떻게 하나요?
0
15
1
소리가 겹쳐서 들려요
0
19
2
20강에서 파인튜닝 때 사용한 데이터가 없어졌습니다. LoRA Trainer 매개변수도 라이브러리 업그레이드로 수정되었습니다.
0
20
1
[개정판] 딥러닝 컴퓨터 비전 완벽 가이드 먼저? 구현하며 배우는 Transformer 먼저?
0
30
1
수업자료
0
23
2
전 강의와 전혀 이어지지가 않음
0
30
1
pytorch local 설치 옵션에 conda 가 없습니다.
0
38
3
pc에서는 괜찮은데 탭으로 들으니 화면확대시 화면이 까맙니다
0
22
1
강의 환경설정 질문
0
39
2
numpy.ndarray 에러
0
62
1
6. 데이터 전처리
0
67
1
섹션 3-4 데이터 전처리하기
0
134
1
섹션 2-1 딥러닝 모형 파트 모형 컴파일에서 에러가 발생합니다.
0
354
1
1.3. 데이터 전처리 강의에서 index do not match 에러가 납니다.
0
423
1
시계열 딥러닝 그래프에서 수치가 달라요
0
328
1
[해결] '모형별 비교'강의 sqrt함수 미정의 오류 수정
0
633
0
[해결] GRU모형 keras 불러오기 오류 수정
0
469
0
[해결] LSTM모형 케라스 recurrent 모듈 도입 에러 수정
2
864
0
[해결] 시계열 차수 추정하기 코드 에러 수정
5
712
0
[해결] 그래프를 통한 기초 데이터 분석 "ValueError: `orient` must start with 'v' or 'h' or be None, but `'V'` was passed."
2
404
0
[해결] 그래프를 통한 기초 데이터 분석 boxplot 에러 코드 수정
3
818
0
화면 글씨가 잘 안보여요
0
236
0
결측치 예측 함수에서 ~ (딜트) 연산자의 의미를 설명 부탁 드립니다.
0
307
0
스케일링 질문드립니다
0
244
0

