-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Saved weights for trained RNN and LSTM models
- Loading branch information
OrestisAlpos
committed
May 14, 2017
1 parent
d76928e
commit 5283cb2
Showing
27 changed files
with
417 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
from keras.models import Sequential | ||
from keras.layers import Dense, Activation, LSTM | ||
from keras.utils.vis_utils import plot_model | ||
import os | ||
import numpy as np | ||
from reader import Reader | ||
|
||
|
||
length = Reader.getInputShape() | ||
|
||
model = Sequential() | ||
|
||
#EXPECTS INPUT AS (nb_sample, timesteps, nb_features), where nb_sample=1 (batch_size = 1), timesteps = 1 and nb_features = length | ||
|
||
#model.add(Dense(40, input_dim = 12, init='uniform', activation='relu')) | ||
model.add(LSTM(units=50, input_shape=(1,length), batch_input_shape=(1,1,length), recurrent_initializer='random_uniform', kernel_initializer='random_uniform', activation='sigmoid', return_sequences=True, stateful=True)) | ||
model.add(LSTM(units=50, recurrent_initializer='random_uniform', kernel_initializer='random_uniform', activation='sigmoid', stateful=True)) | ||
model.add(Dense(5, kernel_initializer='random_uniform', activation = 'softmax')) | ||
|
||
|
||
model.summary() | ||
plot_model(model, to_file='./LSTMmodels/LSTM_2C.png', show_shapes=True) | ||
fp = open('./LSTMmodels/LSTM_2C.json', 'w') | ||
fp.write(model.to_json()) | ||
fp.close() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"config": [{"config": {"recurrent_activation": "hard_sigmoid", "recurrent_initializer": {"config": {"seed": null, "maxval": 0.05, "minval": -0.05}, "class_name": "RandomUniform"}, "implementation": 0, "bias_constraint": null, "unit_forget_bias": true, "units": 50, "trainable": true, "activation": "sigmoid", "return_sequences": true, "use_bias": true, "name": "lstm_1", "bias_initializer": {"config": {}, "class_name": "Zeros"}, "recurrent_regularizer": null, "dropout": 0.0, "recurrent_dropout": 0.0, "kernel_regularizer": null, "dtype": "float32", "bias_regularizer": null, "activity_regularizer": null, "unroll": false, "stateful": true, "batch_input_shape": [1, 1, 79], "kernel_initializer": {"config": {"seed": null, "maxval": 0.05, "minval": -0.05}, "class_name": "RandomUniform"}, "kernel_constraint": null, "recurrent_constraint": null, "go_backwards": false}, "class_name": "LSTM"}, {"config": {"recurrent_activation": "hard_sigmoid", "recurrent_initializer": {"config": {"seed": null, "maxval": 0.05, "minval": -0.05}, "class_name": "RandomUniform"}, "implementation": 0, "bias_constraint": null, "unit_forget_bias": true, "units": 50, "trainable": true, "activation": "sigmoid", "return_sequences": false, "dropout": 0.0, "name": "lstm_2", "bias_initializer": {"config": {}, "class_name": "Zeros"}, "recurrent_regularizer": null, "use_bias": true, "recurrent_dropout": 0.0, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "unroll": false, "stateful": true, "kernel_initializer": {"config": {"seed": null, "maxval": 0.05, "minval": -0.05}, "class_name": "RandomUniform"}, "kernel_constraint": null, "recurrent_constraint": null, "go_backwards": false}, "class_name": "LSTM"}, {"config": {"trainable": true, "use_bias": true, "bias_constraint": null, "units": 5, "activation": "softmax", "bias_regularizer": null, "activity_regularizer": null, "name": "dense_1", "kernel_regularizer": null, "kernel_initializer": {"config": {"seed": null, "maxval": 0.05, "minval": -0.05}, "class_name": "RandomUniform"}, "kernel_constraint": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}}, "class_name": "Dense"}], "backend": "theano", "class_name": "Sequential", "keras_version": "2.0.3"} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.14650396882|0.581|0|0|0 | ||
2|0.134933630332|0.581|0|0|0 | ||
3|0.12807858073|0.581|0|0|0 | ||
4|0.125045746896|0.581|0|0|0 | ||
5|0.123950693227|0.581|0|0|0 | ||
6|0.123648752145|0.581|0|0|0 | ||
7|0.123634647191|0.581|0|0|0 | ||
8|0.123708837941|0.581|0|0|0 | ||
9|0.123797330961|0.581|0|0|0 | ||
10|0.123875424441|0.581|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.146884530544|0.579|0|0|0 | ||
2|0.135687147945|0.579|0|0|0 | ||
3|0.128945879199|0.579|0|0|0 | ||
4|0.125824560031|0.579|0|0|0 | ||
5|0.124595511615|0.579|0|0|0 | ||
6|0.124180880323|0.579|0|0|0 | ||
7|0.124085704312|0.579|0|0|0 | ||
8|0.12410484181|0.579|0|0|0 | ||
9|0.124156942427|0.579|0|0|0 | ||
10|0.124211117879|0.579|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.150555812597|0.55|0|0|0 | ||
2|0.142311920874|0.55|0|0|0 | ||
3|0.136620218471|0.55|0|0|0 | ||
4|0.133332525082|0.55|0|0|0 | ||
5|0.131608594321|0.55|0|0|0 | ||
6|0.130735595852|0.55|0|0|0 | ||
7|0.130294553764|0.55|0|0|0 | ||
8|0.130069818463|0.55|0|0|0 | ||
9|0.129955085322|0.55|0|0|0 | ||
10|0.129897934154|0.55|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|nan|0.548665297741|0|0|0 | ||
2|nan|0.548665297741|0|0|0 | ||
3|nan|0.548665297741|0|0|0 | ||
4|nan|0.548665297741|0|0|0 | ||
5|nan|0.548665297741|0|0|0 | ||
6|nan|0.548665297741|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.132268971939|0.536852063103|0|0|0 | ||
2|0.127221430943|0.536852063103|0|0|0 | ||
3|0.0402869192958|0.90296597201|0|0|0 | ||
4|0.013252615212|0.971286274728|0|0|0 | ||
5|0.00871043029935|0.978256030717|0|0|0 | ||
6|0.00715632640869|0.9796193762|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.131039403329|0.544940222032|0|0|0 | ||
2|0.0857365173791|0.654608774552|0|0|0 | ||
3|0.0308658724279|0.924130017079|0|0|0 | ||
4|0.0121295026073|0.97045794193|0|0|0 | ||
5|0.00885947539087|0.976542485056|0|0|0 | ||
6|0.00754022111713|0.978730785653|0|0|0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.14650396882|0.581|0|0|0 | ||
2|0.134933630332|0.581|0|0|0 | ||
3|0.12807858073|0.581|0|0|0 | ||
4|0.125045746896|0.581|0|0|0 | ||
5|0.123950693227|0.581|0|0|0 | ||
6|0.123648752145|0.581|0|0|0 | ||
7|0.123634647191|0.581|0|0|0 | ||
8|0.123708837941|0.581|0|0|0 | ||
9|0.123797330961|0.581|0|0|0 | ||
10|0.123875424441|0.581|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.146884530544|0.579|0|0|0 | ||
2|0.135687147945|0.579|0|0|0 | ||
3|0.128945879199|0.579|0|0|0 | ||
4|0.125824560031|0.579|0|0|0 | ||
5|0.124595511615|0.579|0|0|0 | ||
6|0.124180880323|0.579|0|0|0 | ||
7|0.124085704312|0.579|0|0|0 | ||
8|0.12410484181|0.579|0|0|0 | ||
9|0.124156942427|0.579|0|0|0 | ||
10|0.124211117879|0.579|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.150555812597|0.55|0|0|0 | ||
2|0.142311920874|0.55|0|0|0 | ||
3|0.136620218471|0.55|0|0|0 | ||
4|0.133332525082|0.55|0|0|0 | ||
5|0.131608594321|0.55|0|0|0 | ||
6|0.130735595852|0.55|0|0|0 | ||
7|0.130294553764|0.55|0|0|0 | ||
8|0.130069818463|0.55|0|0|0 | ||
9|0.129955085322|0.55|0|0|0 | ||
10|0.129897934154|0.55|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|nan|0.548665297741|0|0|0 | ||
2|nan|0.548665297741|0|0|0 | ||
3|nan|0.548665297741|0|0|0 | ||
4|nan|0.548665297741|0|0|0 | ||
5|nan|0.548665297741|0|0|0 | ||
6|nan|0.548665297741|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.132268971939|0.536852063103|0|0|0 | ||
2|0.127221430943|0.536852063103|0|0|0 | ||
3|0.0402869192958|0.90296597201|0|0|0 | ||
4|0.013252615212|0.971286274728|0|0|0 | ||
5|0.00871043029935|0.978256030717|0|0|0 | ||
6|0.00715632640869|0.9796193762|0|0|0 | ||
LSTM_2C Dataset0 Loss:mse Optimizer:sgd Dropout:No | ||
Epoch|Loss|Accuracy|Precision|Recall|Fscore | ||
1|0.131039403329|0.544940222032|0|0|0 | ||
2|0.0857365173791|0.654608774552|0|0|0 | ||
3|0.0308658724279|0.924130017079|0|0|0 | ||
4|0.0121295026073|0.97045794193|0|0|0 | ||
5|0.00885947539087|0.976542485056|0|0|0 | ||
6|0.00754022111713|0.978730785653|0|0|0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
from keras.models import Sequential | ||
from keras.layers import Dense, Activation, SimpleRNN | ||
from keras.utils.vis_utils import plot_model | ||
import os | ||
import numpy as np | ||
from reader import Reader | ||
|
||
|
||
length = Reader.getInputShape() | ||
|
||
model = Sequential() | ||
|
||
#EXPECTS INPUT AS (nb_sample, timesteps, nb_features), where nb_sample=1 (batch_size = 1), timesteps = 1 and nb_features = length | ||
|
||
#model.add(Dense(40, input_dim = 12, init='uniform', activation='relu')) | ||
model.add(SimpleRNN(units=50, input_shape=(1,length), batch_input_shape=(1,1,length), recurrent_initializer='random_uniform', kernel_initializer='random_uniform', activation='sigmoid', return_sequences=True, stateful=True)) | ||
model.add(SimpleRNN(units=50, recurrent_initializer='random_uniform', kernel_initializer='random_uniform', activation='sigmoid', stateful=True)) | ||
model.add(Dense(5, kernel_initializer='random_uniform', activation = 'softmax')) | ||
|
||
|
||
model.summary() | ||
plot_model(model, to_file='./RNNmodels/RNN_2.2C.png', show_shapes=True) | ||
fp = open('./RNNmodels/RNN_2.2C.json', 'w') | ||
fp.write(model.to_json()) | ||
fp.close() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"config": [{"config": {"kernel_regularizer": null, "units": 50, "bias_regularizer": null, "batch_input_shape": [1, 1, 79], "bias_constraint": null, "recurrent_regularizer": null, "stateful": true, "dtype": "float32", "recurrent_dropout": 0.0, "implementation": 0, "recurrent_constraint": null, "use_bias": true, "kernel_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}, "return_sequences": true, "activity_regularizer": null, "name": "simple_rnn_1", "unroll": false, "activation": "sigmoid", "trainable": true, "go_backwards": false, "kernel_constraint": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "dropout": 0.0, "recurrent_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}}, "class_name": "SimpleRNN"}, {"config": {"kernel_regularizer": null, "units": 50, "bias_regularizer": null, "bias_constraint": null, "recurrent_regularizer": null, "stateful": true, "recurrent_dropout": 0.0, "implementation": 0, "recurrent_constraint": null, "use_bias": true, "kernel_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}, "return_sequences": false, "activity_regularizer": null, "name": "simple_rnn_2", "unroll": false, "activation": "sigmoid", "trainable": true, "go_backwards": false, "kernel_constraint": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "dropout": 0.0, "recurrent_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}}, "class_name": "SimpleRNN"}, {"config": {"kernel_regularizer": null, "units": 5, "bias_regularizer": null, "bias_constraint": null, "name": "dense_1", "activity_regularizer": null, "activation": "softmax", "trainable": true, "kernel_constraint": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "use_bias": true, "kernel_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}}, "class_name": "Dense"}], "class_name": "Sequential", "keras_version": "2.0.3", "backend": "theano"} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"keras_version": "2.0.3", "config": [{"config": {"stateful": true, "trainable": true, "bias_regularizer": null, "recurrent_regularizer": null, "return_sequences": true, "use_bias": true, "name": "simple_rnn_1", "activity_regularizer": null, "unroll": false, "dtype": "float32", "activation": "relu", "batch_input_shape": [1, 1, 79], "units": 50, "bias_constraint": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "kernel_regularizer": null, "recurrent_initializer": {"config": {"maxval": 0.05, "minval": -0.05, "seed": null}, "class_name": "RandomUniform"}, "go_backwards": false, "recurrent_constraint": null, "recurrent_dropout": 0.0, "implementation": 0, "dropout": 0.0, "kernel_initializer": {"config": {"maxval": 0.05, "minval": -0.05, "seed": null}, "class_name": "RandomUniform"}, "kernel_constraint": null}, "class_name": "SimpleRNN"}, {"config": {"stateful": true, "trainable": true, "bias_regularizer": null, "recurrent_regularizer": null, "return_sequences": false, "use_bias": true, "name": "simple_rnn_2", "activity_regularizer": null, "unroll": false, "activation": "relu", "units": 50, "bias_constraint": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "kernel_regularizer": null, "recurrent_initializer": {"config": {"maxval": 0.05, "minval": -0.05, "seed": null}, "class_name": "RandomUniform"}, "go_backwards": false, "recurrent_constraint": null, "recurrent_dropout": 0.0, "implementation": 0, "dropout": 0.0, "kernel_initializer": {"config": {"maxval": 0.05, "minval": -0.05, "seed": null}, "class_name": "RandomUniform"}, "kernel_constraint": null}, "class_name": "SimpleRNN"}, {"config": {"bias_constraint": null, "name": "dense_1", "trainable": true, "bias_regularizer": null, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "use_bias": true, "units": 5, "activity_regularizer": null, "kernel_regularizer": null, "kernel_initializer": {"config": {"maxval": 0.05, "minval": -0.05, "seed": null}, "class_name": "RandomUniform"}, "activation": "softmax", "kernel_constraint": null}, "class_name": "Dense"}], "backend": "theano", "class_name": "Sequential"} | ||
{"keras_version": "2.0.3", "config": [{"config": {"return_sequences": true, "use_bias": true, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "units": 50, "dropout": 0.0, "batch_input_shape": [1, 1, 79], "bias_initializer": {"config": {}, "class_name": "Zeros"}, "kernel_regularizer": null, "unroll": false, "recurrent_constraint": null, "name": "simple_rnn_1", "kernel_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}, "implementation": 0, "recurrent_dropout": 0.0, "activation": "relu", "dtype": "float32", "stateful": true, "recurrent_regularizer": null, "bias_constraint": null, "trainable": true, "go_backwards": false, "recurrent_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}}, "class_name": "SimpleRNN"}, {"config": {"return_sequences": false, "use_bias": true, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "units": 50, "dropout": 0.0, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "kernel_regularizer": null, "unroll": false, "recurrent_constraint": null, "name": "simple_rnn_2", "kernel_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}, "implementation": 0, "recurrent_dropout": 0.0, "activation": "relu", "stateful": true, "recurrent_regularizer": null, "bias_constraint": null, "trainable": true, "go_backwards": false, "recurrent_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}}, "class_name": "SimpleRNN"}, {"config": {"activity_regularizer": null, "use_bias": true, "bias_regularizer": null, "kernel_constraint": null, "units": 5, "bias_initializer": {"config": {}, "class_name": "Zeros"}, "kernel_regularizer": null, "bias_constraint": null, "trainable": true, "name": "dense_1", "kernel_initializer": {"config": {"minval": -0.05, "maxval": 0.05, "seed": null}, "class_name": "RandomUniform"}, "activation": "softmax"}, "class_name": "Dense"}], "backend": "theano", "class_name": "Sequential"} |
Binary file added
BIN
+113 KB
RNNmodels/full_models/Dataset0.RNN2.cross-rmsprop.88/Dataset0.RNN_2.2C.h5
Binary file not shown.
Binary file added
BIN
+29.2 KB
RNNmodels/full_models/Dataset0.RNN2.cross-rmsprop.88/Dataset0.RNN_2.2C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.