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…

  1. Create a new Python file, and import the following packages:
    import numpy as np
    import neurolab as nl
  2. Define the input filename:
    # Input file
    input_file = 'letter.data'
  3. 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
  4. 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: Real World Machine Learning 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.