Posts

Showing posts with the label SGD Neural Network

Using mini batch SGD Neural Network in Alphabet recognition!

Here we are using mini-batch stochastic gradient descent neural network method in Alphabet recognition with previous data set mentioned in  nonMNIST data set . First, we are going to build the neural network part. Here we have adjustable number of hidden neurons, layers, epochs, mini batch sizes that allow us to tune the accuracy later. #network part import random import numpy as np class Network(object): def __init__(self, sizes): #sizes: number of neurons (eg: (2,3,1)) #biases and weights are initialized randomly self.num_layers = len(sizes) self.sizes = sizes self.biases = [np.random.randn(y, 1) for y in sizes[1:]] self.weights = [np.random.randn(y, x) for x, y in zip(sizes[:-1], sizes[1:])] def feedforward(self, a): #return output of network f a is input for b, w in zip(self.biases, self.weights): a = sigmoid(np.dot(w, a) + b) return a ...