Write a Java code to implement the main functions of a simple perceptron. The target perceptron has three inputs, one output. Instances Sensor 1 Sensor 2 Sensor 3 Alarm Instance 1 Off Off On Fake Instance 2 On On On Real Instance 3 On Off On Real Instance 4 Off On On Fake This perceptron is used to analyze data from sensor inputs and, based on the analysis, it classifies alarms as true or fake. The table above shows four instances from the alarm box records and their alarm true class. These four instances will be used as a dataset to train the perceptron. After training the perceptron, it will be used to predict the alarm class for an unseen instance. Write the Java code for the following two public classes: Forward_Propagation: This class implements the forward propagation flow. The class does the following Defines the inputs and outputs as double arrays in the code double[][] inputs = new double[][]{ {0, 0, 1}, {1, 1, 1}, {1, 0, 1}, {0, 1, 1} }; double[][] outputs = new double[][]{ {0}, {1}, {1}, {0} }; Generates the initial weights and bias using Math.random(). Calculates the outputs of a given input set. Train_Test: This class runs the training loop for 1000 times. Note that the training phase includes calculating the output and then updating the bias and weights accordingly. After completing the training, it will test the following instance to see if the alarm is real or fake and prints the output on the screen Instances Sensor 1 Sensor 2 Sensor 3 Instance 5 Off Off Off After writing the function, create a main program and call the two methods in the main program. Submit a screenshot of the output along with you code. Students can import external library and use a built-in methods to calculate the sigmoid function and its derivative. it should:  Calculating the sigmoid and its derivative correctly. Adjust weights correctly. Correct implementation of the Train_Test method Correct prediction of the test instance. code integration and printing out the test results at the terminal.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a Java code to implement the main functions of a simple perceptron. The target perceptron has three inputs, one output.

Instances

Sensor 1

Sensor 2

Sensor 3

Alarm

Instance 1

Off

Off

On

Fake

Instance 2

On

On

On

Real

Instance 3

On

Off

On

Real

Instance 4

Off

On

On

Fake

This perceptron is used to analyze data from sensor inputs and, based on the analysis, it classifies alarms as true or fake. The table above shows four instances from the alarm box records and their alarm true class. These four instances will be used as a dataset to train the perceptron. After training the perceptron, it will be used to predict the alarm class for an unseen instance.

Write the Java code for the following two public classes:

  1. Forward_Propagation:

    This class implements the forward propagation flow. The class does the following

    1. Defines the inputs and outputs as double arrays in the code

      double[][] inputs = new double[][]{

      • {0, 0, 1},

        {1, 1, 1},

        {1, 0, 1},

        {0, 1, 1}

      };

      double[][] outputs = new double[][]{

      • {0},

        {1},

        {1},

        {0}

      };

    2. Generates the initial weights and bias using Math.random().

    3. Calculates the outputs of a given input set.

  2. Train_Test:

    This class runs the training loop for 1000 times. Note that the training phase includes calculating the output and then updating the bias and weights accordingly. After completing the training, it will test the following instance to see if the alarm is real or fake and prints the output on the screen

Instances

Sensor 1

Sensor 2

Sensor 3

Instance 5

Off

Off

Off

After writing the function, create a main program and call the two methods in the main program. Submit a screenshot of the output along with you code. Students can import external library and use a built-in methods to calculate the sigmoid function and its derivative.

it should: 

Calculating the sigmoid and its derivative correctly.

Adjust weights correctly.

Correct implementation of the Train_Test method

Correct prediction of the test instance.

code integration and printing out the test results at the terminal.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education