How to do it...

  1. Import the following packages:
import numpy as np 
import neurolab as nl 
  1. Read the input file:
in_file = 'words.data'
  1. Consider 20 data points to build the neural network based system:
# Number of datapoints to load from the input file 
num_of_datapoints = 20
  1. Represent the distinct characters:
original_labels = 'omandig' 
# Number of distinct characters 
num_of_charect = len(original_labels) 
  1. Use 90% of data for training the neural network and the remaining 10% for testing:
train_param = int(0.9 * num_of_datapoints) 
test_param = num_of_datapoints - train_param 
  1. Define the dataset extraction parameters:
s_index = 6 
e_index = -1 
  1. Build the dataset:
information = [] labels = [] with open(in_file, 'r') as f: for line ...

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition 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.