ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 100, 1), found shape=(None, 21)
LSTM 다룰 때 중요한 부분! 에러 ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 100, 1), found shape=(None, 21) 원인 LSTM 모델을 사용할 때는, train 차원을 바꾸어야 하는데, 차원 변경을 해 주지 않으면 발생하는 에러 해결 X_train = X_train.reshape(X_train.shape[0], X_train[1], 1) 명령으로 2차원 데이터를 3차원으로 변경하면 됨.
2022. 1. 20.
GridSearchCV 평가 - 최적 파라미터 출력
코드 from sklearn.model_selection import GridSearchCV params = { 'n_estimators':[100], 'max_depth' : [6,8,10.,12], 'min_samples_leaf' : [8,12, 18], 'min_samples_split' : [8,16, 20] } rf_clf = RandomForestClassifier(random_state=0) model = rf_clf grid_cv = GridSearchCV(model, param_grid=params, cv=2, n_jobs=-1) grid_cv.fit(X_train, y_train) print('Best parameter:\n', grid_cv.best_params_) print('Hi..
2022. 1. 17.