ML.Neural.Network.Network

Package ML :: Package Neural :: Module Network :: Class Network |
[hide private]
[frames] | no frames]

# Class Network

source code

    a neural network

Instance Methods | [hide private]
ConstructRandomWeights(self, minWeight=-1, maxWeight=1) initialize all the weights in the network to random numbers... | source code
FullyConnectNodes(self) Fully connects each layer in the network to the one above it... | source code
ConstructNodes(self, nodeCounts, actFunc, actFuncParms) build an unconnected network and set node counts **Arguments** - nodeCounts: a list containing the number of nodes to be in each layer. | source code
GetInputNodeList(self) returns a list of input node indices... | source code
GetOutputNodeList(self) returns a list of output node indices... | source code
GetHiddenLayerNodeList(self, which) returns a list of hidden nodes in the specified layer... | source code
GetNumNodes(self) returns the total number of nodes... | source code
GetNumHidden(self) returns the number of hidden layers... | source code
GetNode(self, which) returns a particular node... | source code
GetAllNodes(self) returns a list of all nodes... | source code
ClassifyExample(self, example, appendExamples=0) classifies a given example and returns the results of the output layer. | source code
GetLastOutputs(self) returns the complete list of output layer values from the last time this node classified anything | source code
__str__(self) provides a string representation of the network | source code
__init__(self, nodeCounts, nodeConnections=None, actFunc=<class 'ML.Neural.ActFuncs.Sigmoid'>, actFuncParms=`(``)`, weightBounds=1) Constructor This constructs and initializes the network based upon the specified node counts. | source code

Method Details | [hide private]

### ConstructRandomWeights(self, minWeight=-1, maxWeight=1) | source code
    initialize all the weights in the network to random numbers

    **Arguments**

      - minWeight: the minimum value a weight can take

      - maxWeight: the maximum value a weight can take

### FullyConnectNodes(self) | source code
    Fully connects each layer in the network to the one above it

    **Note**
      this sets the connections, but does not assign weights

### ConstructNodes(self, nodeCounts, actFunc, actFuncParms) | source code
    build an unconnected network and set node counts

    **Arguments**

      - nodeCounts: a list containing the number of nodes to be in each layer.
         the ordering is:
          (nInput,nHidden1,nHidden2, ... , nHiddenN, nOutput)

### GetInputNodeList(self) | source code
    returns a list of input node indices

### GetOutputNodeList(self) | source code
    returns a list of output node indices

### GetHiddenLayerNodeList(self, which) | source code
    returns a list of hidden nodes in the specified layer

### GetNumNodes(self) | source code
    returns the total number of nodes

### GetNumHidden(self) | source code
    returns the number of hidden layers

### GetNode(self, which) | source code
    returns a particular node

### GetAllNodes(self) | source code
    returns a list of all nodes

### ClassifyExample(self, example, appendExamples=0) | source code
    classifies a given example and returns the results of the output layer.

    **Arguments**

      - example: the example to be classified

    **NOTE:**

      if the output layer is only one element long,
      a scalar (not a list) will be returned.  This is why a lot of the other
      network code claims to only support single valued outputs.

### __init__(self, nodeCounts, nodeConnections=None, actFunc=<class 'ML.Neural.ActFuncs.Sigmoid'>, actFuncParms=`(``)`, weightBounds=1) (Constructor) | source code
    Constructor

    This constructs and initializes the network based upon the specified
    node counts.

    A fully connected network with random weights is constructed.

    **Arguments**

      - nodeCounts: a list containing the number of nodes to be in each layer.
         the ordering is:
          (nInput,nHidden1,nHidden2, ... , nHiddenN, nOutput)

      - nodeConnections: I don't know why this is here, but it's optional.  ;-)

      - actFunc: the activation function to be used here.  Must support the API
          of _ActFuncs.ActFunc_.

      - actFuncParms: a tuple of extra arguments to be passed to the activation function
          constructor.

      - weightBounds:  a float which provides the boundary on the random initial weights