-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from Hector-hedb12/issue_150_lstm_binary_text…
…_classifier Issue 150: Long Short-Term Memory (LSTM) Binary Classifier for texts
- Loading branch information
Showing
2 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
137 changes: 137 additions & 0 deletions
137
mlprimitives/jsons/keras.Sequential.LSTMBinaryTextClassifier.json
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,137 @@ | ||
{ | ||
"name": "keras.Sequential.LSTMBinaryTextClassifier", | ||
"contributors": [ | ||
"Hector Dominguez <hedb_12@hotmail.com>" | ||
], | ||
"description": "Long Short-Term Memory (LSTM) Binary Classifier for texts", | ||
"classifiers": { | ||
"type": "estimator", | ||
"subtype": "classifier" | ||
}, | ||
"modalities": [], | ||
"primitive": "mlprimitives.adapters.keras.Sequential", | ||
"fit": { | ||
"method": "fit", | ||
"args": [ | ||
{ | ||
"name": "X", | ||
"type": "ndarray" | ||
}, | ||
{ | ||
"name": "y", | ||
"type": "array" | ||
}, | ||
{ | ||
"name": "vocabulary_size", | ||
"type": "int", | ||
"description": "vocabulary size + 1: number of known words in input." | ||
} | ||
] | ||
}, | ||
"produce": { | ||
"method": "predict", | ||
"args": [ | ||
{ | ||
"name": "X", | ||
"type": "ndarray" | ||
} | ||
], | ||
"output": [ | ||
{ | ||
"name": "y", | ||
"type": "array" | ||
} | ||
] | ||
}, | ||
"hyperparameters": { | ||
"fixed": { | ||
"classification": { | ||
"type": "bool", | ||
"default": true | ||
}, | ||
"loss": { | ||
"type": "str", | ||
"default": "keras.losses.binary_crossentropy" | ||
}, | ||
"optimizer": { | ||
"type": "str", | ||
"default": "keras.optimizers.RMSprop" | ||
}, | ||
"metrics": { | ||
"type": "list", | ||
"default": [ | ||
"accuracy" | ||
] | ||
}, | ||
"epochs": { | ||
"type": "int", | ||
"default": 20 | ||
}, | ||
"verbose": { | ||
"type": "int", | ||
"default": 0, | ||
"range": [ | ||
0, | ||
2 | ||
] | ||
}, | ||
"layers": { | ||
"type": "list", | ||
"default": [ | ||
{ | ||
"class": "keras.layers.Embedding", | ||
"parameters": { | ||
"input_dim": "vocabulary_size", | ||
"output_dim": "embedding_output_dim" | ||
} | ||
}, | ||
{ | ||
"class": "keras.layers.LSTM", | ||
"parameters": { | ||
"units": "lstm_units" | ||
} | ||
}, | ||
{ | ||
"class": "keras.layers.Dropout", | ||
"parameters": { | ||
"rate": "dropout_rate" | ||
} | ||
}, | ||
{ | ||
"class": "keras.layers.Dense", | ||
"parameters": { | ||
"units": 2, | ||
"activation": "sigmoid" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"tunable": { | ||
"embedding_output_dim": { | ||
"type": "int", | ||
"default": 100, | ||
"range": [ | ||
100, | ||
500 | ||
] | ||
}, | ||
"lstm_units": { | ||
"type": "int", | ||
"default": 100, | ||
"range": [ | ||
100, | ||
500 | ||
] | ||
}, | ||
"dropout_rate": { | ||
"type": "float", | ||
"default": 0.5, | ||
"range": [ | ||
0.0, | ||
0.75 | ||
] | ||
} | ||
} | ||
} | ||
} |
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,28 @@ | ||
{ | ||
"metadata": { | ||
"name": "keras.Sequential.LSTMBinaryTextClassifier", | ||
"data_type": "text", | ||
"task_type": "classification" | ||
}, | ||
"validation": { | ||
"dataset": "personae" | ||
}, | ||
"primitives": [ | ||
"mlprimitives.custom.counters.VocabularyCounter", | ||
"mlprimitives.custom.feature_extraction.StringVectorizer", | ||
"keras.Sequential.LSTMBinaryTextClassifier" | ||
], | ||
"output_names": { | ||
"mlprimitives.custom.counters.VocabularyCounter#1": { | ||
"counts": "vocabulary_size" | ||
} | ||
}, | ||
"init_params": { | ||
"mlprimitives.custom.counters.VocabularyCounter#1": { | ||
"add": 1 | ||
}, | ||
"keras.Sequential.LSTMBinaryTextClassifier#1": { | ||
"epochs": 1 | ||
} | ||
} | ||
} |