From 7b2666b9b488e2d4cb8bd9dbae399c2c0111ce44 Mon Sep 17 00:00:00 2001 From: Hector Dominguez Date: Wed, 3 Apr 2019 22:32:32 -0400 Subject: [PATCH 1/5] add `keras.Sequential.VGGCNNClassifier` primitive --- .../keras.Sequential.VGGCNNClassifier.json | 268 ++++++++++++++++++ 1 file changed, 268 insertions(+) create mode 100644 mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json diff --git a/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json new file mode 100644 index 00000000..d9ac6b86 --- /dev/null +++ b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json @@ -0,0 +1,268 @@ +{ + "name": "keras.Sequential.VGGCNNClassifier", + "contributors": [ + "Hector Dominguez " + ], + "description": "VGG-like Convolutional Neural Network Classifier", + "classifiers": { + "type": "estimator", + "subtype": "classifier" + }, + "modalities": [], + "primitive": "mlprimitives.adapters.keras.Sequential", + "fit": { + "method": "fit", + "args": [ + { + "name": "X", + "type": "ndarray" + }, + { + "name": "y", + "type": "array" + }, + { + "name": "classes", + "type": "int", + "description": "Number of classes" + } + ] + }, + "produce": { + "method": "predict", + "args": [ + { + "name": "X", + "type": "ndarray" + } + ], + "output": [ + { + "name": "y", + "type": "array" + } + ] + }, + "hyperparameters": { + "fixed": { + "classification": { + "type": "bool", + "default": true + }, + "conv2d_1_filters": { + "type": "int", + "default": 32 + }, + "input_shape": { + "type": "list", + "default": [ + 224, + 224, + 3 + ] + }, + "conv2d_2_filters": { + "type": "int", + "default": 32 + }, + "conv2d_3_filters": { + "type": "int", + "default": 32 + }, + "conv2d_4_filters": { + "type": "int", + "default": 32 + }, + "loss": { + "type": "str", + "default": "keras.losses.categorical_crossentropy" + }, + "optimizer": { + "type": "str", + "default": "keras.optimizers.SGD" + }, + "metrics": { + "type": "list", + "default": [ + "accuracy" + ] + }, + "epochs": { + "type": "int", + "default": 20 + }, + "layers": { + "type": "list", + "default": [ + { + "class": "keras.layers.Conv2D", + "parameters": { + "filters": "conv2d_1_filters", + "kernel_size": "conv2d_1_kernel_size", + "activation": "relu", + "input_shape": "input_shape" + } + }, + { + "class": "keras.layers.Conv2D", + "parameters": { + "filters": "conv2d_2_filters", + "kernel_size": "conv2d_2_kernel_size", + "activation": "relu" + } + }, + { + "class": "keras.layers.MaxPooling2D", + "parameters": { + "pool_size": "maxpooling2d_1_pool_size" + } + }, + { + "class": "keras.layers.Dropout", + "parameters": { + "rate": "dropout_1_rate" + } + }, + { + "class": "keras.layers.Conv2D", + "parameters": { + "filters": "conv2d_3_filters", + "kernel_size": "conv2d_3_kernel_size", + "activation": "relu" + } + }, + { + "class": "keras.layers.Conv2D", + "parameters": { + "filters": "conv2d_4_filters", + "kernel_size": "conv2d_4_kernel_size", + "activation": "relu" + } + }, + { + "class": "keras.layers.MaxPooling2D", + "parameters": { + "pool_size": "maxpooling2d_2_pool_size" + } + }, + { + "class": "keras.layers.Dropout", + "parameters": { + "rate": "dropout_2_rate" + } + }, + { + "class": "keras.layers.Flatten", + "parameters": {} + }, + { + "class": "keras.layers.Dense", + "parameters": { + "units": "dense_units", + "activation": "relu" + } + }, + { + "class": "keras.layers.Dropout", + "parameters": { + "rate": "dropout_3_rate" + } + }, + { + "class": "keras.layers.Dense", + "parameters": { + "units": "classes", + "activation": "softmax" + } + } + ] + } + }, + "tunable": { + "conv2d_1_kernel_size": { + "type": "int", + "default": 3, + "range": [ + 3, + 10 + ] + }, + "conv2d_2_kernel_size": { + "type": "int", + "default": 3, + "range": [ + 3, + 10 + ] + }, + "maxpooling2d_1_pool_size": { + "type": "int", + "default": 2, + "range": [ + 2, + 10 + ] + }, + "dropout_1_rate": { + "type": "float", + "default": 0.0, + "range": [ + 0.0, + 0.75 + ] + }, + "conv2d_3_kernel_size": { + "type": "int", + "default": 3, + "range": [ + 3, + 10 + ] + }, + "conv2d_4_kernel_size": { + "type": "int", + "default": 3, + "range": [ + 3, + 10 + ] + }, + "maxpooling2d_2_pool_size": { + "type": "int", + "default": 2, + "range": [ + 2, + 10 + ] + }, + "dropout_2_rate": { + "type": "float", + "default": 0.0, + "range": [ + 0.0, + 0.75 + ] + }, + "dense_units": { + "type": "int", + "default": 64, + "range": [ + 1, + 500 + ] + }, + "dropout_3_rate": { + "type": "float", + "default": 0.5, + "range": [ + 0.0, + 0.75 + ] + }, + "batch_size": { + "type": "int", + "default": 128 + } + } + } +} From 78a563c2b762a9c50233f87fc330172c7c067fde Mon Sep 17 00:00:00 2001 From: Hector Dominguez Date: Thu, 4 Apr 2019 12:31:19 -0400 Subject: [PATCH 2/5] create pipeline for `keras.Sequential.VGGCNNClassifier` primitive --- .../keras.Sequential.VGGCNNClassifier.json | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 pipelines/keras.Sequential.VGGCNNClassifier.json diff --git a/pipelines/keras.Sequential.VGGCNNClassifier.json b/pipelines/keras.Sequential.VGGCNNClassifier.json new file mode 100644 index 00000000..aa627458 --- /dev/null +++ b/pipelines/keras.Sequential.VGGCNNClassifier.json @@ -0,0 +1,33 @@ +{ + "metadata": { + "name": "keras.Sequential.VGGCNNClassifier", + "data_type": "image", + "task_type": "classification" + }, + "validation": { + "dataset": "usps", + "context": {} + }, + "primitives": [ + "mlprimitives.custom.counters.UniqueCounter", + "keras.Sequential.VGGCNNClassifier" + ], + "input_names": { + "mlprimitives.custom.counters.UniqueCounter#1": { + "X": "y" + } + }, + "output_names": { + "mlprimitives.custom.counters.UniqueCounter#1": { + "counts": "classes" + } + }, + "init_params": { + "mlprimitives.custom.counters.UniqueCounter#1": { + "add": 1 + }, + "keras.Sequential.VGGCNNClassifier#1": { + "epochs": 1 + } + } +} From 3a680632748a845bde90edbbde621ad08175753c Mon Sep 17 00:00:00 2001 From: Hector Dominguez Date: Mon, 15 Apr 2019 08:38:58 -0400 Subject: [PATCH 3/5] remove `batch_size` tunable parameter --- mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json index d9ac6b86..d501324b 100644 --- a/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json +++ b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json @@ -258,10 +258,6 @@ 0.0, 0.75 ] - }, - "batch_size": { - "type": "int", - "default": 128 } } } From 904a33c55b3c58a0cd4e5849ec63e59e45c16bb5 Mon Sep 17 00:00:00 2001 From: Hector Dominguez Date: Mon, 15 Apr 2019 08:44:09 -0400 Subject: [PATCH 4/5] add `verbose` fixed parameter --- mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json index d501324b..34583d2c 100644 --- a/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json +++ b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json @@ -91,6 +91,14 @@ "type": "int", "default": 20 }, + "verbose": { + "type": "int", + "default": 1, + "range": [ + 0, + 2 + ] + }, "layers": { "type": "list", "default": [ From 24c9abd2153e799cf39c24f1185fb772c7e09d68 Mon Sep 17 00:00:00 2001 From: Hector Dominguez Date: Mon, 15 Apr 2019 09:31:17 -0400 Subject: [PATCH 5/5] default `verbose` to 0 --- mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json index 34583d2c..404304a7 100644 --- a/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json +++ b/mlprimitives/jsons/keras.Sequential.VGGCNNClassifier.json @@ -93,7 +93,7 @@ }, "verbose": { "type": "int", - "default": 1, + "default": 0, "range": [ 0, 2