From 4d05461e86a34ee9c8777a3c7900ba7763a36c9a Mon Sep 17 00:00:00 2001 From: Kristina Ulicna Date: Thu, 29 Oct 2020 21:04:04 +0000 Subject: [PATCH 1/3] Defined CNNClassifier class --- cellx/networks/classifier.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cellx/networks/classifier.py b/cellx/networks/classifier.py index da745d1..0a3f335 100644 --- a/cellx/networks/classifier.py +++ b/cellx/networks/classifier.py @@ -1 +1,8 @@ -# this will be the classifier +# This will be the CNN classifier: + +import tensorflow as tf + +inputs = tf.keras.Input(shape=(2,)) +x = tf.keras.layers.Dense(4, activation=tf.nn.relu)(inputs) +outputs = tf.keras.layers.Dense(4, activation=tf.nn.softmax)(x) +model = tf.keras.Model(inputs=inputs, outputs=outputs) From 41e25f5508d55922f9c6d72ec50ad06a77bc122b Mon Sep 17 00:00:00 2001 From: Kristina Ulicna Date: Fri, 30 Oct 2020 10:43:08 +0000 Subject: [PATCH 2/3] Imported Encoder2D() from layers.py --- cellx/networks/classifier.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cellx/networks/classifier.py b/cellx/networks/classifier.py index 0a3f335..4daf424 100644 --- a/cellx/networks/classifier.py +++ b/cellx/networks/classifier.py @@ -1,8 +1,13 @@ -# This will be the CNN classifier: +# Building the CNN classifier: import tensorflow as tf +from tensorflow import keras as K -inputs = tf.keras.Input(shape=(2,)) -x = tf.keras.layers.Dense(4, activation=tf.nn.relu)(inputs) -outputs = tf.keras.layers.Dense(4, activation=tf.nn.softmax)(x) -model = tf.keras.Model(inputs=inputs, outputs=outputs) +from cellx import layers + +input = K.Input(shape=(2,)) +encoder = layers.Encoder2D()(input) +dense = K.layers.Dense(512, activation="relu")(encoder) +output = K.layers.Dense(4, activation=tf.nn.softmax)(dense) + +classifier_model = K.Model(inputs=input, outputs=output) From fd6c7bfc91ed049636c7ce7d0162702631b9dfa5 Mon Sep 17 00:00:00 2001 From: Kristina Ulicna <48791041+KristinaUlicna@users.noreply.github.com> Date: Fri, 30 Oct 2020 11:15:22 +0000 Subject: [PATCH 3/3] Update cellx/networks/classifier.py Co-authored-by: Alan R Lowe --- cellx/networks/classifier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cellx/networks/classifier.py b/cellx/networks/classifier.py index 4daf424..7079051 100644 --- a/cellx/networks/classifier.py +++ b/cellx/networks/classifier.py @@ -3,7 +3,7 @@ import tensorflow as tf from tensorflow import keras as K -from cellx import layers +from ..layers import Encoder2D input = K.Input(shape=(2,)) encoder = layers.Encoder2D()(input)