-
Notifications
You must be signed in to change notification settings - Fork 1
Release 1
Preston Tranbarger edited this page Feb 20, 2019
·
23 revisions
basicNeuralNet(nodes, learningRate)
The constructor passes 2 parameters: an array containing the amount of nodes in each layer, and a number that dictates the learning rate in stochastic gradient decent.
nn = basicNeuralNet([2, 3, 1], 0.1)
This creates a object, called nn, of basicNeuralNet with 2 nodes in its input layer, 3 nodes in its 1st intermediate layer and 1 node in its output layer, and it sets the learning rate to be 0.1.
getNodes()
There are no parameters for this method.
This method returns the object’s stored value for the array nodes, an array which contains the number of nodes in each layer.
print(nn.getNodes())```
This prints:<br/>
```[2, 3, 1]```
## getLearningRate()
### Parameters
```getLearningRate()```
There are no parameters for this method.
### Return
This method returns the objects stored value for the learning rate, a number which dictates the rate of stochastic gradient decent.
### Example
```nn = basicNeuralNet([2, 3, 1], 0.1)
print(nn.getLearningRate())```
This prints:<br/>
```0.1```
## setLearningRate()
### Parameters
```setLearningRate(learningRate)```
This method passes 1 parameter: a number that dictates the learning rate in stochastic gradient decent.
### Return
This method returns None.
### Example
```nn = basicNeuralNet([2, 3, 1], 0.1)
print(nn.getLearningRate())
nn.setLearningRate(0.01)
print(nn.getLearningRate())```
This prints:<br/>
```0.1
0.01```
## getWeights()
### Parameters
```getWeights()```
There are no parameters for this method.
### Return
This method returns the object's stored value for weights, an array containing the weight of each connection between nodes.
### Example
```nn = basicNeuralNet([1, 2, 1], 0.1)
print(nn.getWeights())```
This could print (output varies based off of the values stored in the object's weight array):<br/>
```[[[0.835734567971406], [0.21740565479821994]], [[0.6464352637609099, 0.10556332348227149]]]```
For details of how the weight array is created, please look at the code in the __init__ method.
More coming later...
Released 2/15/19 by QPU Misaligned