Open mohammadriazi opened 6 years ago
Hey. I am sorry for my late answer. Can you provide me the data set so that I just run the same code as yours?
Hey Edourd! Thanks for getting back to me. Unfortunately I can't disclose the data I'm working with. Imagine a mXn dataset (m= # of samples, n = 128 integer values). I was thinking maybe I could use the hidden layers as sort of lower dimension features instead of 128 raw values.
I found the same issue opened on a different git repo https://github.com/fchollet/keras/issues/41
Here is the code they suggested:
# this is your initial model
model = Sequential()
model.add(Dense(20, 64, init='uniform'))
model.add(Activation('tanh'))
model.add(Dense(64, 1, init='uniform'))
model.add(Activation('softmax'))
# we train it
model.compile(loss='mse', optimizer='sgd')
model.fit(X_train, y_train, nb_epoch=20, batch_size=16)
# we build a new model with the activations of the old model
# this model is truncated after the first layer
model2 = Sequential()
model2.add(Dense(20, 64, weights=model.layers[0].get_weights()))
model2.add(Activation('tanh'))
activations = model2._predict(X_batch)
I haven't tested this myself, but when I do I'll write back. Thanks
I am trying to implement a denoising LSTM based outlier detection method. my dataset consists of 730 rows of samples, each sample contains 128 values. This is my code so far:
Building the model here:![image](https://user-images.githubusercontent.com/3881209/29016990-bec7888e-7b8f-11e7-9756-e05a7bac2f9f.png)
I want to return the model and the middle most hidden layer:![image](https://user-images.githubusercontent.com/3881209/29017005-d3f7f748-7b8f-11e7-834c-0fe7bf465d38.png)
I dont receive any errors when I train the model, however, I would like to know
Thanks