Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Correct answers get a thumbs up! To implement perceptron neural networks to simu

ID: 3711068 • Letter: C

Question

Correct answers get a thumbs up!

To implement perceptron neural networks to simulate the function for classifying an image with 2 x 2 pixels as shown in the PPT. Your input will be 16 training examples checker Remember: 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" You may write your code in a contemporary language of your choice; typical languages would include C/C++, Java, Ada, Pascal, Smalltalk, Lisp, and Prolog. A GUI interface is preferred. Submit a hard copy of your well-commented source program and your printed output if any. In addition, please give a demo on your program in the classroom in the due day. Please do not take codes from the website. Try to understand the algorithm and implement the algorithm by your own.

Explanation / Answer

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<4;i++)
{
ar[i]=sc.nextInt();// data entry

}
for(int i=0;i<4;i++)
{
if(ar[i]==1)// condition to check
{
y++;
}
}
if(y==0||y==1)//final decision statement
{
System.out.println("Bright");
}
else
{
System.out.println("Dark");
}
System.out.println("Press 0 to continue 1 to exit");
a=sc.nextInt();// to continue press 0
}
while(a==0);
}
}