더미처리 후 model.fit() 에서 오류가 납니다.
미해결
[입문자를 위한] 캐글로 시작하는 머신러닝 • 딥러닝 분석
# 범주형 데이터의 카테고리 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을 카테고리 & 더미 처리를 하면 딥러닝이 되지 않는지? 궁금합니다.
- 카테고리
- kaggle
- 더미처리
- 머신러닝 배워볼래요?
- 딥러닝
- 딥러닝





