diff --git a/mlprimitives/jsons/keras.Sequential.LSTMBinaryTextClassifier.json b/mlprimitives/jsons/keras.Sequential.LSTMBinaryTextClassifier.json new file mode 100644 index 00000000..6e82af8a --- /dev/null +++ b/mlprimitives/jsons/keras.Sequential.LSTMBinaryTextClassifier.json @@ -0,0 +1,137 @@ +{ + "name": "keras.Sequential.LSTMBinaryTextClassifier", + "contributors": [ + "Hector Dominguez " + ], + "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 + ] + } + } + } +} diff --git a/pipelines/keras.Sequential.LSTMBinaryTextClassifier.json b/pipelines/keras.Sequential.LSTMBinaryTextClassifier.json new file mode 100644 index 00000000..db8fddb2 --- /dev/null +++ b/pipelines/keras.Sequential.LSTMBinaryTextClassifier.json @@ -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 + } + } +}