Programming Assignment
University of The People
CS 4407-01: Data Mining and Machine Learning
Instructor: Naeem Ahmed
29th July 2025
Introduction
This presentation outlines my work on developing and training a neural network to
identify the digits 0 to 9 and the letters A to F, as well as H, when they are shown on a seven-
segment display. It will feature screenshots, comments, and concise explanations where
necessary, and will wrap up with a brief conclusion.
Preliminaries
I will construct a neural network, load the pattern file, and train it to recognize characters
based on the segment patterns inputted through the Basic Prop neural network simulator. My
design will utilize the seven-segment display illustrated below, with each segment acting as an
individual input to the neural network. The corresponding ASCII code (in binary) for the
identified letter or number will be produced as the output based on the input pattern.
Part 1: Writing the pattern file
The basic Prop simulator utilizes a pattern file to train the neural network. In this instance,
I encoded both the input and output data and transformed it into a format compatible with the
software.
a. Input Encoding
The input is represented in binary format as a seven-element vector, where each index
corresponds to a specific point on the display. I arranged the segments of the display unit in
my pattern file in the order 9, 8, 7, 6, 5, 4, 3, 2, 1 from left to right. This arrangement aligns
with the binary representation of the ASCII code (which is also read from left to right) and
makes it easier for me to interpret the binary digits. If a segment is illuminated for a number,
its value is one; if not, it is zero.
b. Output Encoding
Since the software required both binary input and output, I also encoded the output in
binary format. The ASCII values were converted into binary. Refer to the graph above for a
visual representation.
c. Training File Snapshot
The image above shows a snapshot of the text file I will use to train the network. It has
the necessary extension (.pat) for the basic Prop simulator to recognize it as an input pattern
file. (For more details, see the pattern file named 7segment.pat.)
Part 2: Network Creation
a. Configuring the Network
To set up the network, I selected Configure Network from the options in the
Network menu. I chose a three-layer feed-forward network consisting of six neurons,
with both inputs and outputs set to seven (matching the pattern I created in part 1) and an
output bias of one. Below are the screenshots, along with the attached file 7segment.net
for reference.
b. Loading the Pattern File
Next, I loaded my pattern file into the network for training by selecting Load
Patterns from the Patterns dropdown menu and choosing the file I created in section 1. I
then used the control panel on the right to initiate the training process. The parameters I
selected included a learning rate of 0.3, momentum of 0.8, 5000 learning steps, and a
weight range of -1 to 1. After loading the pattern file, I clicked the Train button.
The screenshots of the error progress graph illustrate that the errors are steadily
converging towards 0, indicating that my model is performing well.
After 20,000 learning steps, the error rate was already close to the target of less
than 5% (0.05) as required by the assignment. I decided to run an additional 5000 steps,
which brought the error rate down to 0.049.
I continued training, and after 50,000 steps, the error rate improved to 0.03.
I then extended the training to 100,000 steps, achieving an error rate of 0.024,
which is half of the minimum required, marking my testing as a success.
c. Testing the Model
To evaluate the model, I selected individual patterns and clicked the Test One
button. The screenshots below show the results for 17 distinct patterns from my pattern
file.
Conclusion
These activities effectively demonstrate how to construct and train a basic feed-forward
artificial neural network. As noted by Gershenson (2003), training and learning involve applying
an algorithm to adjust weights to achieve the desired outcome, which is a form of supervised
learning. I believe I have successfully accomplished this while gaining valuable insights; my next
goal is to further reduce my error rate.
References
Gershenson, C. (2003). Artificial neural networks for beginners. Retrieved from:
http://arxiv.org/ftp/cs/papers/0308/0308031.pdf