I am trying to use Sparse numpy matrix for keras with tensorflow as backend. The model compiles but while fit, gives an error. Code is as follows. Any help is appreciated.
from keras.layers import Dense, Input
from keras.models import Model
inputs = Input(shape=(trainX.shape[1],), sparse=True)
outputs = Dense(trainY.shape[1], activation='softmax')(inputs)
model = Model(inputs=inputs, outputs=outputs)
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
trainX is
<2404941x337071 sparse matrix of type '<type 'numpy.float64'>'
with 4765705 stored elements in Compressed Sparse Row format>
and similarly trainY is a CSR matrix
model.fit(trainX, trainY, verbose=1)
gives following error
ValueError: setting an array element with a sequence.