Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in GO to simulate a neural network with several sofas in which each neuron runs concurrently. In this exercise, consider the case

Write a program in GO to simulate a neural network with several sofas in which each neuron runs concurrently. In this exercise, consider the case of a 3-sofa network: an input layer, a hidden layer and an output layer. Entry to this network is a slice of real numbers. The length of this slice corresponds to the number of neurons in this first layer. The hidden layer will be composed of 3 neurons. And the output will be made from a single neuron.

Each neuron calculates a weighted sum of its inputs (including a special fixed neuron) then applies to the result a sigmoid function (v) = 1/1+e-v . The result thus obtained by the neuron is sent as input to the neurons of the next layer to which it is connected. The figure below shows a neural network made up of 2 inputs.

image text in transcribed

In this case, the equation used to calculate the output of the first hidden neuron is 1 = (10 + 111 + 122). The equation for the output neuron is 1 = (10 + 111 + 122 + 133). The first layer neurons 1 and 2 simply send the input values to the higher neurons.

You need to design a Go program to calculate the output of a neural network based on the input data. The calculation of each neuron must be done in a go rountine; the neuron must therefore wait until it has received all the output values (communicated via a channel) from its input neurons before calculating the value of its output.

Your program must first create the network shown above with:

image text in transcribed

Then a for loop will calculate the network output for a series of input values. These input values will be simulated with the following formulas 1 =sin 2pi*k/N and X2 = cos 2pi*k/N with N being the number of data to generate as specified by the user and k = 0,, N-1. Attention, before calculating the output value at iteration k, you must make sure that the calculation at iteration k-1 has been completed. The output value of a network is communicated to the main program via a channel. The main function simply prints an input vector and the corresponding output on each line.

Output Layer Hidden Layer 22 22 Hidden Layer Input 1 x X x2 2 a 10 = 0.1 011 = 0.3 212 = 0.4 azo = 0.5 az = 0.8 azz = 0.3 030 = 0.7 031 = 0.6 azz = 0.6 B10 = 0.5 B11 = 0.3 B12 = 0.7 B 13 = 0.1 Output Layer Hidden Layer 22 22 Hidden Layer Input 1 x X x2 2 a 10 = 0.1 011 = 0.3 212 = 0.4 azo = 0.5 az = 0.8 azz = 0.3 030 = 0.7 031 = 0.6 azz = 0.6 B10 = 0.5 B11 = 0.3 B12 = 0.7 B 13 = 0.1

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago