aosabook / 500lines

500 Lines or Less
Other
29.31k stars 5.87k forks source link

Some error in project "ocr" #243

Open kaelchan opened 8 years ago

kaelchan commented 8 years ago

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.

kaelchan commented 8 years ago

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.

morenoh149 commented 8 years ago

I have the following notes:

I'd be happy to submit a PR @emtwo .

zhenfelix commented 4 years ago

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.

Moreover, there is only one epoch for the training process which is not enough