Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.NeuralNetwork.BackPropagation.Layer.AbstractLayer Class Reference
Inheritance diagram for Bio.NeuralNetwork.BackPropagation.Layer.AbstractLayer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __str__
def set_weight

Public Attributes

 nodes
 weights

Detailed Description

Abstract base class for all layers.

Definition at line 18 of file Layer.py.


Constructor & Destructor Documentation

def Bio.NeuralNetwork.BackPropagation.Layer.AbstractLayer.__init__ (   self,
  num_nodes,
  has_bias_node 
)
Initialize the layer.

Arguments:

o num_nodes -- The number of nodes that are contained in this layer.

o has_bias_node -- Specify whether or not this node has a bias
node. This node is not included in the number of nodes in the network,
but is used in constructing and dealing with the network.

Reimplemented in Bio.NeuralNetwork.BackPropagation.Layer.OutputLayer, and Bio.NeuralNetwork.BackPropagation.Layer.InputLayer.

Definition at line 21 of file Layer.py.

00021 
00022     def __init__(self, num_nodes, has_bias_node):
00023         """Initialize the layer.
00024 
00025         Arguments:
00026 
00027         o num_nodes -- The number of nodes that are contained in this layer.
00028 
00029         o has_bias_node -- Specify whether or not this node has a bias
00030         node. This node is not included in the number of nodes in the network,
00031         but is used in constructing and dealing with the network.
00032         """
00033         # specify all of the nodes in the network
00034         if has_bias_node:
00035             lower_range = 0
00036         else:
00037             lower_range = 1
00038 
00039         self.nodes = range(lower_range, num_nodes + 1)
00040 
00041         self.weights = {}

Here is the caller graph for this function:


Member Function Documentation

Debugging output.

Definition at line 42 of file Layer.py.

00042 
00043     def __str__(self):
00044         """Debugging output.
00045         """
00046         return "weights: %s" % self.weights

def Bio.NeuralNetwork.BackPropagation.Layer.AbstractLayer.set_weight (   self,
  this_node,
  next_node,
  value 
)
Set a weight value from one node to the next.

If weights are not explicitly set, they will be initialized to
random values to start with.

Reimplemented in Bio.NeuralNetwork.BackPropagation.Layer.OutputLayer.

Definition at line 47 of file Layer.py.

00047 
00048     def set_weight(self, this_node, next_node, value):
00049         """Set a weight value from one node to the next.
00050 
00051         If weights are not explicitly set, they will be initialized to
00052         random values to start with.
00053         """
00054         if (this_node, next_node) not in self.weights:
00055             raise ValueError("Invalid node values passed.")
00056         
00057         self.weights[(this_node, next_node)] = value


Member Data Documentation

Definition at line 38 of file Layer.py.


The documentation for this class was generated from the following file: