Exploring feeding user data into Ketos objects
I wish to program a working example of building different Ketos neural net models.
Specifically, I am starting with constructing a simple MLP following the suggestions I found in Ketos documentation as "Adding the ketos Neural Network interface to your own architectures"
My current progress is stymied by not knowing what do do when presented with the setting of needed parameter values for instantiating class MLPInterface
Here is the defining code from ketos documentation:
class MLP(Model):
def __init__(self, n_neurons, activation):
super(MLP, self).__init__()
self.dense = tfk.layers.Dense(n_neurons, activation=activation)
self.final_node = tfk.layers.Dense(10)
def call(self, inputs):
output = self.dense(inputs)
output = self.dense(output)
output = self.final_node(output)
class MLPInterface(NNInterface):
def __init__(self, n_neurons, activation, optimizer, loss_function, metrics):
super(MLPInterface, self).__init__(optimizer, loss_function, metrics)
self.n_neurons = n_neurons
self.activation = activation
self.model = MLP(n_neurons=n_neurons, activation=activation)
My plan is to feed the mnist numpy arrays and corresponding labels and run the NN to take the 28x28 arrays, flatten them maybe, and send the 784 linear arrays in matching them to 1 of 10 label integer values into this MLPInterface.
I have things running until the train_loop which throws an error likely because I don't know how to specify optimizer, loss_function, and metrics
I will put the code as it is now in my github. https://github.com/orcasound/orca-autoencoder/blob/main/MLP/MLP_Ketos.py
I will deeply appreciate any suggestions.
And, I have not yet figured out how to get the class definitions above to print nicely here:-(