Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created April 20, 2019 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/d3c418118baf430a6e674c700e305b41 to your computer and use it in GitHub Desktop.
Save NMZivkovic/d3c418118baf430a6e674c700e305b41 to your computer and use it in GitHub Desktop.
class IrisClassifier(Model):
def __init__(self):
super(IrisClassifier, self).__init__()
self.layer1 = Dense(10, activation='relu')
self.layer2 = Dense(10, activation='relu')
self.outputLayer = Dense(3, activation='softmax')
def call(self, x):
x = self.layer1(x)
x = self.layer2(x)
return self.outputLayer(x)
model = IrisClassifier()
model.compile(optimizer=tf.keras.optimizers.Adam(),
loss='categorical_crossentropy',
metrics=['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment