Professional Documents
Culture Documents
Lab #1
1. Introduction
1.1 Perceptron learning algorithm
How does a Perception (Artificial Neuron) learn?
3. Important Functions
3.1 halfmoon(rad,width,dist,num_samp)
A function to generate the halfmoon data,
where Input:
rad - central radius of the half moon
width - width of the half moon
dist - distance between two half moon
num_samp - total number of the samples
Output:
data - output data (data belonging to first region then data belonging to second region)
data_shuffled - shuffled data (i.e. data belonging to both regions not in order)
For example
halfmoon(10,2,0,1000) will generate 1000 data of two half moons with radius [9-11] and
space 0.
3.2 mysign(d)
Represents the activation function. It is a threshold function that outputs 0 or 1.
4. Assignment
Implement the Perceptron learning algorithm using C#.
HINTS: You will need to create a “Perceptron class” whose members might include:
1. Perceptron weights,
2. Perceptron inputs,
3. “StartTraining” function,
4. “StartTesting” function,
5. And the helper functions “Adder” and “ActivationFunction”.