Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago