Question: Implement perceptron neural networks to simulate the function for classifying an image with 2 x 2 pixels as shown below. Your input will be 16

Implement perceptron neural networks to simulate the function for classifying an image with 2 x 2 pixels as shown below. Your input will be 16 training examples. C++, Java, or Python is acceptable. Include a description of how the program works.

Thumbs up if it's done right! Also, posting this program gets a thumbs down.

import java.util.Scanner; public class Main{

public static void main(String []args){ int a=0; int ar[]=new int[4]; int y=0; Scanner sc=new Scanner(System.in); do // statement executes for all 16 and more cases till you enter 0 { System.out.println("Please enter the matrix 2*2 for black enter 1 else 0"); for(int i=0;i

Implement perceptron neural networks to simulate the function for classifying an image

with 2 x 2 pixels as shown below. Your input will be

If the image contains 2, 3 or 4 white pixels, the output of perceptron is bright. If it contains 0 or 1 white pixels, it is classified as dark.

Some notes about the learning algorithm:

-Weights are set randomly initially

-For each training example E:

1) Calculate the observed output from the ANN, o(E)

2) If the target output t(E) is different to o(E), then tweak all the weights so that o(E) gets closer to t(E)

3) Tweaking is done by perceptron training rule (listed below). This routine is done for every input example E.

4) Dont necessarily stop when all examples used, repeat the cycle again (called an epoch) until the ANN produces the correct output for all the examples in the training set (or good enough)

Perceptron training rule:

16 training examples. C++, Java, or Python is acceptable. Include a description

Online Search Tool Example: Perceptron INPUT INPUT LAYER OUTPUT LAYE OUTPUT CATEGORY PIXEL 1- ?( x1 0.25 If S>-0.1 BRIGHT PIXEL 2 ??( x2 0.25 0.25 PIXEL 3- ? x3 otherwise -1 DARK 0.25 PIXEL 4 s-0.25%1 + 0.25%2 + 0.25%3 + 0.25%4 ? . Example calculation: x-1, x21, X3-1, x4-1 s-0.25%(-1) + 0.25*(1) + 0.25%(1) + 0.25%(-1)-0 -0.1, so the output from the ANN is +1 So the image is categorised as "bright" . 0 95

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!