Not new to Python or programming but I'm fairly new to machine learning so I was hoping I'm just overlooking something simple. At the moment I keep running into an issue where Keras spits out the following Value Error:
ValueError: Error when checking input: expected flatten_input to have 3 dimensions, but got array with shape (483, 1)
So to provide some context and show you all the bit of code I'm working with, please refer to the example below.
# for the sake of argument, let's say we are feeding in an array of floats labeled 'getReturns' # in this case, lets say 'getReturns' contains a total of 569 values trainingLen = int(float(len(getReturns)) * 0.85) # reserves 85 percent for training trainingData = getReturns[:trainingLen] testingData = getReturns[trainingLen:-1] model = keras.Sequential() model.add(keras.layers.Flatten(input_shape = (569, 1))) model.add(keras.layers.Dense(59, activation = "relu")) model.add(keras.layers.Dense(1, activation = "softmax")) model.compile(optimizer = "adam", loss = "sparse_categorical_crossentropy", metrics = ["accuracy"]) model.fit(trainingData, testingData, epochs = 5)
Though it may be obvious, the "model.fit" line is the one causing the actual error but I suspect something is wrong with the way I am bringing in data? I'm not sure if I need to reshape my array somehow or if the problem is stemming from something even more fundamental? Any help would be appreciated.