make a basic neural network which can predict something useful, like predicting the digits in the mnist database of handwritten digits.
In [22]:
import numpy as np
class NeuralNetwork(object):
def __init__(self):
self.input_layer = 28*28
self.hidden_layer = 20
self.output_layer = 10
self.weigths_input_hidden = np.random.randn(self.input_layer,self.hidden_layer)
self.weights_hidden_output = np.random.randn(self.hidden_layer,self.output_layer)
self.biases_input_hidden = np.random.randn(self.hidden_layer)
self.biases_hidden_output = np.random.randn(self.output_layer)
def sigmoid(x):
return 1.0/(1.0+np.exp(-x))
n = NeuralNetwork()
n.weigths_input_hidden.shape, n.weights_hidden_output.shape
Out[22]:
In [25]:
n.sigmoid(1.1)
In [ ]: