Building an optical character recognizer using neural networks
Now that we know how to interact with the data, let's build a neural network-based optical character-recognition system.
How to do it…
- Create a new Python file, and import the following packages:
import numpy as np import neurolab as nl
- Define the input filename:
# Input file input_file = 'letter.data'
- When we work with neural networks that deal with large amounts of data, it takes a lot of time to train. To demonstrate how to build this system, we will take only
20
datapoints:# Number of datapoints to load from the input file num_datapoints = 20
- If you look at the data, you will see that there are seven distinct characters in the first 20 lines. Let's define them:
# Distinct characters orig_labels ...
Get Python Machine Learning Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.