[Solved] CMSC421 Project 3

$25

File Name: CMSC421_Project_3.zip
File Size: 160.14 KB

SKU: [Solved] CMSC421 Project 3 Category: Tag:
5/5 - (1 vote)

What youll need to do

  • Implement and train a basic neural network with backpropagation
    • Well give you part of the code, you need to fill in the details
  • Well give you a ZIP archive containing two files:
    • py: the class and method outlines

studenttest.py: code to train and test your neural network

  • py contains some, but not all, of the necessary methods
    • Youll need to write the others yourself

activation(z):

  • This is the activation function used in the feed-forward compution of the network.
  • The included function is the sigmoid, but you can change this as you see fit.

Here is a graph showing visually how the sigmoid function works:

sigderiv(z):

This is the derivative of the sigmoid function

  • Youll need to use it to update the values when training your neural network
  • If you use an activation function other than the sigmoid, then youll need to use a different derivative than the one returned by sigderiv

Class: neuralnetwork:

__init__(self, size, seed):

  • This function will initialize the weights and biases for a neural network of the size specified by the size parameter. The size parameter is a list of the form
    • inputsize, hidden layer 1 size, , hidden layer n size, output size]
  • Example on next page

Example of __init__

Suppose size = [3, 4, 4, 1]

  • then __init__ creates the network shown at right
  • It initializes a variable weights = [ [v11 v12 v13]

[v21 v22 v23] [v31 v32 v33]

[v41 v42 v43] ]

  • each vij is the weight on the connection to unit i in the first hidden layer from unit j in the input layer

Methods/Classes provided in studNet.py (continued) forward(self, input):

Given a vector of input parameters of form:

[ [parameter 11, p12, , p1n] [p21, p22, , p2n] ] This method will return a 3-tuple:

  • the output value(s) of each example (the variable a in the source code)

The values before activation was applied after the input was weighted (the variable pre_activations)

The values after activation for all layers (the variable activations)

  • The reason it returns pre_activations and activations is because youll need them for updating the network

What you have to do:

  • Implement a method called train()
    • test_train calls it to train the neural network on the data set

To do this training, you will need to perform back propagation and calculate deltas

  • Weve provided method headers for train(), backpropagate(), and calcDeltas()
    • If you want to use them, youll need to write the method bodies

But you dont have to use them if you want to implement your network differently

  • The only things that must stay the same for testing:
    • you MUST have the test_train method and predict as provided

test_train must return an instance of your neural network that can be used to call predict(a).

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CMSC421 Project 3
$25