Some error in project "ocr"
kaelchan opened this issue · 3 comments
In neural_network_design.py
The outer loop for j in xrange(100):
is useless since the prediction of the neural network is definite.
I think the author tried to combined the training process in the outer loop. Anyway, some correction should be made.
In server.py
nn = OCRNeuralNetwork(HIDDEN_NODE_COUNT, data_matrix, data_labels, list(range(5000)));
the startup training using range(5000) for train_indices, this is not a good choice as the data is ordered (from 0 to 9). This would make the neural network output 9 for every input. Instead it should be like random.sample(range(5000), 5000)
or anything like this.
I have the following notes:
- missing closing
};
in ocr.js - inconsistent indentation, sometimes 2, sometimes 4
- server.py
- some statements end with semicolon (;). Don’t do this.
- ocr.py
- self.theta blocks following def _rand_initialize_weights should have less indentation ?
- typo “ while smaller values will will generate an ANN” remove second “will”
- Testing a Trained Network: “ def predict(self, test):
y1 = np.dot(np.mat(self.theta1), np.mat(test).T)
y1 = y1 + np.mat(self.input_layer_bias) # Add the bias”
lacks syntax highlighting and has an extra space after the second assignment
I'd be happy to submit a PR @emtwo .
In
server.py
nn = OCRNeuralNetwork(HIDDEN_NODE_COUNT, data_matrix, data_labels, list(range(5000)));
the startup training using range(5000) for train_indices, this is not a good choice as the data is ordered (from 0 to 9). This would make the neural network output 9 for every input. Instead it should be likerandom.sample(range(5000), 5000)
or anything like this.
Moreover, there is only one epoch for the training process which is not enough