Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is a sketch of a small C++ program to implement simple fixed-size perceptrons (three nodes, two edges). It includes a main program that once

Below is a sketch of a small C++ program to implement simple fixed-size perceptrons (three nodes, two edges). It includes a main program that once the functions are working correctly will print the truth tables for AND, OR, and NAND! See the sections marked TODO. Here is the expected output:

AND:

0 0: 0

0 1: 0

1 0: 0

1 1: 1

OR:

0 0: 0

0 1: 1

1 0: 1

1 1: 1

NAND:

0 0: 1

0 1: 1

1 0: 1

1 1: 0

// Simple perceptron logic gate implementation

#include

using namespace std;

float step_function(float threshold, float value)

{

// TODO

return 0;

}

float run_perceptron(float weightA, float weightB, float valueA, float valueB, float threshold)

{

// TODO

return 0;

}

void show_truth_table(float weightA, float weightB, float threshold)

{

// TODO: call run_perceptron 4 times,

// feeding it all four values of A,B.

}

int main()

{

cout << "AND: ";

show_truth_table(0.4, 0.4, 0.5);

cout << "OR: ";

show_truth_table(0.6, 0.6, 0.5);

// TODO: can you figure out two weights and a threshold

// that will implement "NAND"? This is the opposite of AND.

cout << "NAND: ";

show_truth_table(0,0,0);

return 0;

}

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions

Question

What basic questions can HR analytics answer?

Answered: 1 week ago

Question

=+2 Why did OBI create Centers of Excellence?

Answered: 1 week ago