def test_create_neural_network_object_with_dimensions_param(self): test_dimensions = (2, 10, 13, 15) neural_network = dendrites.NeuralNetwork(dimensions=test_dimensions) self.assertEqual(test_dimensions, neural_network.dimensions)
def setUp(self): self.test_inputs = [1, 0, 1] self.test_outputs = [1, 0] self.neural_network = dendrites.NeuralNetwork(dimensions=(3, 4, 2)) self.neural_network.add(input=self.test_inputs, output=self.test_outputs) self.neural_network.train()
def test_create_neural_network_object_with_inputs_outputs_params(self): test_inputs = 10 test_outputs = 10 neural_network = dendrites.NeuralNetwork(inputs=test_inputs, outputs=test_outputs) self.assertEqual(test_inputs, neural_network.dimensions[0]) self.assertEqual(test_outputs, neural_network.dimensions[-1])
import dendrites import logging # Create the logger logger = logging.getLogger() logger.setLevel(logging.DEBUG) # Create the neural network with 2 layers, input and output layer. # The Input layer has 2 inputs, and the output layer has 3 outputs. MyNeuralNet = dendrites.NeuralNetwork(dimensions=(2, 3)) # Add a supervised dataset -- tell the network how to behave MyNeuralNet.add(input=[0, 1], output=[0, 1, 0]) # Train the network MyNeuralNet.train() # Run the network on the dataset we provided earlier, and see the results. logger.info(MyNeuralNet.run(input=[0, 1])) # Save the MyNeuralNet in a net.dat file, so we can use it later (without Training it again) MyNeuralNet.save(location="net.dat") # Delete MyNeuralNet from memory del (MyNeuralNet) # Now lets load the network from the net.dat file we created earlier. MyLoadedNeuralNet = dendrites.NeuralNetwork() MyLoadedNeuralNet.load(location="net.dat") # Lets run the network one more time on the dataset we provided earlier,
def test_create_neural_network_object(self): neural_network = dendrites.NeuralNetwork() self.assertIsNotNone(neural_network)
def setUp(self): self.neural_network = dendrites.NeuralNetwork(dimensions=(3, 4, 2)) self.neural_network.add(input=[1, 1, 1], output=[1, 1])
def setUp(self): self.neural_network = dendrites.NeuralNetwork(dimensions=(3, 4, 2))