index error while trying to fit model keras

anonymous

i'm trying to create an autoencoder with keras, here's my code:

from keras import models, layers
from numpy import array
import random

data = array(
    [array([[random.randint(0, 100) for i in range(50)]]) for i in range(500)]
).reshape((500, 50))
model = models.Sequential()
model.add(layers.Dense(input_dim=50, units=50, activation="sigmoid"))
model.add(layers.Dense(units=40, activation="sigmoid"))
model.add(layers.Dense(units=50, activation="sigmoid"))
model.compile(optimizer="adam", loss="mean_squared_error", metrics=["accuracy"])
model.fit(data, epochs=1)

and my error is :

Python\Python36\lib\site-packages\keras\engine\training_arrays.py", line 139, in fit_loop
    if issparse(ins[i]) and not K.is_sparse(feed[i]):
IndexError: list index out of range
sietschie

You forgot to provide the target data. In you case its the same as the input data, but you still need to tell keras that. This line should work:

model.fit(data, data, epochs=1)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

regarding UnicodeDecodeError error while invoking model.fit in Keras

AssertionError while trying to fit model python

Keras model fit_generator odd error

Keras Model fit throws shape mismatch error

Getting error while trying to fit to GridSearchCV

Jupyter kernel dies trying to fit a Keras model with a custom layer

AssertionError while trying to concatenate two models and fit in Keras

How to fix 'MemoryError' while fitting keras model with fit_generator?

Error while trying to import Keras in Python 3.6

Keras model to fit polynomial

Model Fit Keras

Error while training Keras regression model

Value error while training model in Keras

Model method error while trying to navigate

Type error when trying to fit a VGG like model

I am trying to fit an CuDNNLSTM model and I am getting an error

ValueError while trying to run the Sequential Model from Keras

Error while importing load_model from keras.model

IndexError: list index out of range while keras model.predict()

trying to callibrate keras model

Keras Sequential model fit shape

shuffle in the model.fit of keras

Keras model.fit UnboundLocalError

Keras fit not training model weights

How to fix failed assertion `output channels should be divisible by group' when trying to fit the model in Keras?

I am trying to build a variational autoencoder. I am getting an error while running model.fit which I don't understand

'Resource exhausted' memory error when trying to train a Keras model

Error when trying to rename a pretrained model on tf.keras

Why does the keras model compile but the fit_generator command throws a 'model not compiled runtime error'?