I have 70 thousand text samples that I have implemented using Keras preprocessing. This gives me an array [40, 20, 142...]which I then pad for length 28 (the longest sample length). All I'm trying to do is predict these values for some sort of categorical label (say, from 0 to 5). When I train the model, I can’t get anything except -13% accuracy (currently my mistake is that I tried many ways to pass input).
This is my data at the moment, and I'm just trying to create a simple LSTM. Again, my data is X → [length 28 integer values, embeddings] and Y → [1 integer length 3, (100, 143, etc.)]. Any ideas what I'm doing wrong ?? I asked many people and no one could help. Here is the code for my model ... any ideas? :(
optimizer = RMSprop(lr=0.01) #saw this online, no idea
model = Sequential()
model.add(Embedding(input_dim=28,output_dim=1,init='uniform')) #28 features, 1 dim output?
model.add(LSTM(150)) #just adding my LSTM nodes
model.add(Dense(1)) #since I want my output to be 1 integer value
model.compile(loss='sparse_categorical_crossentropy', optimizer=optimizer, metrics=['accuracy'])
print(model.summary())
Edit:
use model.add(Embedding(input_dim=900,output_dim=8,init='uniform'))seems to work, however accuracy still never improves; I don't know what to do.
source
share