Q: Как решить проблему Error when checking input: with incorrect size Я только начал разбираться с задачей регрессии, ссылка на задание https://www.kaggle.com/c/bike-sharing-demand. Выводит ошибку (когда тренирую модель), как можно решить ее?
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import keras

import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
import matplotlib.pyplot as plt

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

train_data = pd.read_csv('/kaggle/input/bike-sharing-demand/train.csv')
train_targets = train_data[['casual', 'registered', 'count']]

train_datetime_helper = train_data[['datetime']]

dt = pd.DatetimeIndex(train_data['datetime'])
train_data['day'] = dt.day
train_data['month'] = dt.month
train_data['year'] = dt.year
train_data['hour'] = dt.hour
train_data['dow'] = dt.dayofweek
train_data['woy'] = dt.weekofyear

train_data = train_data.drop(['casual', 'registered', 'count', 'datetime'], axis=1)

test_data = pd.read_csv('/kaggle/input/bike-sharing-demand/test.csv')

test_datetime_helper = test_data[['datetime']]

dt = pd.DatetimeIndex(test_data['datetime'])

test_data['day'] = dt.day
test_data['month'] = dt.month
test_data['year'] = dt.year
test_data['hour'] = dt.hour
test_data['dow'] = dt.dayofweek
test_data['woy'] = dt.weekofyear

test_data = test_data.drop(['datetime'], axis=1)

mean = train_data.mean(axis=0)
train_data -= mean
std = train_data.std(axis=0)
train_data /= std

test_data -= mean
test_data /= std


from keras import models
from keras import layers
from keras.layers import Dense, Conv2D, Flatten

def build_model():
    model = models.Sequential()
    model.add(layers.Dense(64, activation='relu', input_shape=(train_data.shape[1], train_targets.shape[1])))
    model.add(layers.Dense(64, activation='relu'))
    model.add(layers.Dense(1))
    model.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])
    return model

k = 4

num_val_samples = len(train_data) // k
num_epochs = 100
all_scores = []
for i in range(k):
    print('Processing fold #', i)
    val_data = train_data[i * num_val_samples: (i + 1) * num_val_samples]
    val_targets = train_targets[i * num_val_samples: (i + 1) * num_val_samples]

    partial_train_data = np.concatenate(
        [train_data[:i * num_val_samples],
        train_data[(i + 1) * num_val_samples:]], axis=0)
    partial_train_targets = np.concatenate(
        [train_targets[:i * num_val_samples],
        train_targets[(i + 1) * num_val_samples:]], axis=0)

    model = build_model()

    model.fit(partial_train_data, partial_train_targets,
             epochs=num_epochs, batch_size=1, verbose=0)

    val_mse, val_mae = model.evaluate(val_data, val_targets, verbose=0)

    all_scores.append(val_mae)

Ошибка, я понимаю что ошибка в размере, а на каком этапе и как ее исправить нет:

ValueError                                Traceback (most recent call
  last)  in 
       27 
       28     model.fit(partial_train_data, partial_train_targets,
  ---> 29              epochs=num_epochs, batch_size=1, verbose=0)
       30 
       31     val_mse, val_mae = model.evaluate(val_data, val_targets, verbose=0)
/opt/conda/lib/python3.7/site-packages/keras/engine/training.py in
  fit(self, x, y, batch_size, epochs, verbose, callbacks,
  validation_split, validation_data, shuffle, class_weight,
  sample_weight, initial_epoch, steps_per_epoch, validation_steps,
  validation_freq, max_queue_size, workers, use_multiprocessing,
  **kwargs)    1152             sample_weight=sample_weight,    1153             class_weight=class_weight,
  -> 1154             batch_size=batch_size)    1155     1156         # Prepare validation data.
/opt/conda/lib/python3.7/site-packages/keras/engine/training.py in
  _standardize_user_data(self, x, y, sample_weight, class_weight, check_array_lengths, batch_size)
      577             feed_input_shapes,
      578             check_batch_axis=False,  # Don't enforce the batch size.
  --> 579             exception_prefix='input')
      580 
      581         if y is not None:
/opt/conda/lib/python3.7/site-packages/keras/engine/training_utils.py
  in standardize_input_data(data, names, shapes, check_batch_axis,
  exception_prefix)
      133                         ': expected ' + names[i] + ' to have ' +
      134                         str(len(shape)) + ' dimensions, but got array '
  --> 135                         'with shape ' + str(data_shape))
      136                 if not check_batch_axis:
      137                     data_shape = data_shape[1:]
ValueError: Error when checking input: expected dense_1_input to have
  3 dimensions, but got array with shape (8165, 14)

