더미처리 후 model.fit() 에서 오류가 납니다.
808
작성한 질문수 2
# 범주형 데이터의 카테고리
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을 카테고리 & 더미 처리를 하면 딥러닝이 되지 않는지? 궁금합니다.
답변 1
0
model.add(Dense(units=160, activation='relu', input_dim=52))
이 코드에서 input_dim 에 입력한 값이 df_out.shape 을 봤을 때 열의 값과 동일한지 한번 체크해보세요!
(매우 긴급).env 관련 질문입니다.
0
23
1
15강 강의내용 코드 내용
0
25
1
자료에 대해서 건의합니다.
0
26
1
교제가 따로 있을까요?
0
29
1
강의 업로드 일정
0
47
1
강의에서 실행하는 데이터(csv파일)은 어디서 다운받나요?
1
47
2
<핸즈온 머신러닝 with 사이킷런, 파이토치> 챌린지 쿠폰 관련 문의드립니다
0
52
1
"핸즈온 머신러닝 with 사이킷런, 파이토치 예제 코드 해설" 쿠폰
0
49
4
"핸즈온 머신러닝 with 사이킷런, 파이토치 예제 코드 해설" 쿠폰
0
48
2
numpy.ndarray 에러
0
131
1
6. 데이터 전처리
0
113
1
섹션 3-4 데이터 전처리하기
0
206
1
섹션 2-1 딥러닝 모형 파트 모형 컴파일에서 에러가 발생합니다.
0
434
1
1.3. 데이터 전처리 강의에서 index do not match 에러가 납니다.
0
512
1
시계열 딥러닝 그래프에서 수치가 달라요
0
383
1
[해결] '모형별 비교'강의 sqrt함수 미정의 오류 수정
0
691
0
[해결] GRU모형 keras 불러오기 오류 수정
0
507
0
[해결] LSTM모형 케라스 recurrent 모듈 도입 에러 수정
2
910
0
[해결] 시계열 차수 추정하기 코드 에러 수정
5
765
0
[해결] 그래프를 통한 기초 데이터 분석 "ValueError: `orient` must start with 'v' or 'h' or be None, but `'V'` was passed."
2
446
0
[해결] 그래프를 통한 기초 데이터 분석 boxplot 에러 코드 수정
3
877
0
화면 글씨가 잘 안보여요
0
271
0
결측치 예측 함수에서 ~ (딜트) 연산자의 의미를 설명 부탁 드립니다.
0
342
0
스케일링 질문드립니다
0
282
0





