Package pyrobot :: Package brain :: Module governor :: Class GovernorSRN
[frames | no frames]

Class GovernorSRN

   Governor --+
              |
Network --+   |
          |   |
        SRN --+
              |
             GovernorSRN


Method Summary
  __init__(self, bufferSize, epsilon, delta, historySize, alpha, mask, verbosity)
  add(self, layer, verbosity)
Adds a layer.
  addContextLayer(self, name, size, hiddenLayerName, verbosity)
  addLayer(self, name, size, verbosity)
  addThreeLayers(self, i, h, o)
  connect(self, fromName, toName)
Connects two layers by instantiating an instance of Connection class.
  decayModelVectors(self)
  networkStep(self, **args)
This exists so that other extensions can interface at the point where the call is made to Network.step().
  report(self, hist)
  setEpsilon(self, liveEpsilon, govEpsilon)
  setLearning(self, value)
Sets learning to value.
  setMomentum(self, liveMomentum, govMomentum)
  setSequenceType(self, value)
You must set this! Set it to "epoch" or "pattern".
  setVerbosity(self, val)
  sweep(self)
Runs through entire dataset.
  trainFromBuffers(self)
  trainFromModelVectors(self)
    Inherited from Governor
  __nextitem__(self)
For use in iterable positions: >>> govnet = GovernorNetwork() >>> for item in govnet: ...
  distancesTo(self, vector)
Computes euclidean distance from a vector to all model vectors.
  incompatibility(self)
For each model, how different is it from each of the buffer items? Returns list of incompatibilities.
  input(self, vector)
Wrapper around ravq.input() which returns index and mapped-to m.v.
  loadRAVQ(self, filename)
Loads RAVQ data from a file.
  map(self, vector)
Returns the index and vector of winning position.
  nextItem(self)
Public interface for getting next item from RAVQ.
  saveRAVQ(self, filename)
Saves RAVQ data to a file.
  setBalancedMask(self)
Give each layer an equal weighting, so that all weights sum to one.
  setMask(self, **args)
Takes a dictionary of layer names and mask weights.
  winner(self)
Get's winning name, m.v.
    Inherited from SRN
  addContext(self, layer, hiddenLayerName, verbosity)
Adds a context layer.
  addSRNLayers(self, inc, hidc, outc)
Wraps SRN.addThreeLayers() for compatibility.
  backprop(self)
Extends backprop() from Network to automatically deal with context layers.
  copyHiddenToContext(self)
Uses key to identify the hidden layer associated with each layer in the self.contextLayers dictionary.
  predict(self, inName, outName)
Sets prediction between an input and output layer.
  propagate(self, **args)
SRN.propagate: Sets error flags and propagates.
  setContext(self, value)
Clears the context layer by setting context layer to (default) value 0.5.
  setInitContext(self, value)
Clear context layer between sequences.
  setLearnDuringSequence(self, value)
Set self.learnDuringSequence.
  step(self, **args)
SRN.step() Extends network step method by automatically copying hidden layer activations to the context layer.
  sweepCrossValidation(self)
sweepCrossValidation() will go through each of the crossvalidation input/targets.
    Inherited from Network
  __getitem__(self, name)
Returns the layer specified by name.
  __len__(self)
Returns the number of layers in the network.
  __str__(self)
Returns string representation of network.
  activationFunction(self, x)
Determine the activation of a node based on that nodes net input.
  ACTPRIME(self, act)
Used in compute_error.
  addPattern(self, word, vector)
Adds a pattern with key word.
  arrayify(self)
Returns an array of node bias values and connection weights for use in a GA.
  associate(self, inName, outName)
inName layer and outName layer will be auto-associating.
  ce_init(self)
Initializes error computation.
  change_weights(self)
Changes the weights according to the error values calculated during backprop().
  changeLayerSize(self, layername, newsize)
Changes layer size.
  closeLog(self, layerName)
Close the layerName's log file.
  compare(self, v1, v2)
Compares two values.
  compute_error(self)
Computes error for all non-output layers backwards through all projections.
  compute_wed(self)
Computes weight error derivative for all connections in self.connections starting with the last connection.
  copyActivations(self, layer, vec, start)
Copies activations in vec to the specified layer, replacing patterns if necessary.
  copyTargets(self, layer, vec, start)
Copies targets in vec to specified layer, replacing patterns if necessary.
  copyVector(self, vector1, vec2, start)
Copies vec2 into vector1 being sure to replace patterns if necessary.
  cycle(self)
Alternate to sweep().
  delPattern(self, word)
Delete a pattern with key word.
  diff(self, value)
Returns value to within 0.001.
  display(self)
Displays the network to the screen.
  getActivationsDict(self, nameList)
Returns a dictionary of layer names that map to a list of activations.
  getActive(self, layerName)
Returns the value of the active flag for the layer specified by layerName.
  getConnection(self, lfrom, lto)
Returns the connection instance connecting the specified (string) layer names.
  getCorrect(self, layerName)
Returns the number of correct activation within tolerance of a layer.
  getData(self, pos)
Returns dictionary with input and target given pos.
  getDataCrossValidation(self, pos)
  getEpsilon(self)
Returns the epsilon for the Network instance.
  getError(self, *layerNames)
  getLayer(self, name)
Returns the layer with the argument (string) name.
  getLayerIndex(self, layer)
Given a reference to a layer, returns the index of that layer in self.layers.
  getPattern(self, word)
Returns the pattern with key word.
  getWeights(self, fromName, toName)
Gets the weights of the connection between two layers (argument strings).
  getWord(self, pattern)
Returns the word associated with pattern.
  initialize(self)
Initializes network by calling Connection.initialize() and Layer.initialize().
  loadCrossValidation(self, filename)
  loadDataFromFile(self, filename, ocnt)
Loads data (targets/inputs) from file.
  loadInputPatternsFromFile(self, filename, cols, everyNrows, delim, checkEven)
Loads inputs as patterns from file.
  loadInputsFromFile(self, filename, cols, everyNrows, delim, checkEven)
Loads inputs from file.
  loadTargetPatternssFromFile(self, filename, cols, everyNrows, delim, checkEven)
Loads targets as patterns from file.
  loadTargetsFromFile(self, filename, cols, everyNrows, delim, checkEven)
Loads targets from file.
  loadVectorsFromFile(self, filename, cols, everyNrows, delim, checkEven, patterned)
Load a set of vectors from a file.
  loadWeightsFromFile(self, filename, mode)
Loads weights from a file in pickle, plain, or tlearn mode.
  logLayer(self, layerName, fileName)
Sets the layerName's log feature.
  logMsg(self, layerName, message)
Logs a message with layerName log.
  mapInput(self, layerName, offset)
Adds layerName and offset to inputMap.
  mapInputs(self, nameOffsetPairs)
  mapTarget(self, layerName, offset)
Adds layerName and offset to targetMap.
  mapTargets(self, nameOffsetPairs)
  path(self, startLayer, endLayer)
Used in error checking with verifyArchitecture() and in prop_from().
  patternVector(self, vector)
Replaces vector with patterns.
  postStep(self)
  postSweep(self)
  preStep(self)
  preSweep(self)
  Print(self, msg)
  prompt(self)
  prop_from(self, startLayers)
Start propagation from the layers in the list startLayers.
  propagateFrom(self, startLayer, **args)
Propagates activation through the network.
  putActivations(self, dict)
Puts a dict of name: activations into their respective layers.
  randomizeOrder(self)
Randomizes self.loadOrder, the order in which inputs set with self.setInputs() are presented.
  replacePatterns(self, vector)
Replaces patterned inputs or targets with activation vectors.
  reportEpoch(self, epoch, tssErr, totalCorrect, totalCount, rmsErr)
  reportFinal(self, epoch, tssErr, totalCorrect, totalCount, rmsErr)
  reportPattern(self)
  reportStart(self)
  reset(self)
Resets seed values.
  resetFlags(self)
Resets layer flags for activation and target.
  RMSError(self)
Returns Root Mean Squared Error for all output layers in this network.
  saveDataToFile(self, filename)
Saves data (targets/inputs) to file.
  saveInputsToFile(self, filename)
Saves inputs to file.
  saveNetworkForCrossValidation(self, filename, mode)
  saveNetworkToFile(self, filename, makeWrapper)
Saves network to file using pickle.
  saveTargetsToFile(self, filename)
Saves targets to file.
  saveWeightsToFile(self, filename, mode)
Saves weights to file in pickle, plain, or tlearn mode.
  setActive(self, layerName, value)
Sets a layer to active.
  setAutoCrossValidation(self, value)
  setAutoSaveWeightsFile(self, filename)
  setBatch(self, value)
Sets self.batch to value.
  setInputs(self, inputs)
Sets self.input to inputs.
  setInputsAndTargets(self, data1, data2)
Network.setInputsAndTargets() Sets the corpus of data for training.
  setInteractive(self, value)
Sets interactive to value.
  setLayerVerification(self, value)
  setMaxRandom(self, value)
Sets the maxRandom Layer attribute for each layer to value.Specifies the global range for randomly initialized values, [-max, max].
  setOrderedInputs(self, value)
Sets self.orderedInputs to value.
  setOutputs(self, outputs)
For compatiblity.
  setPattern(self, word, vector)
Sets a pattern with key word.
  setPatterned(self, value)
Sets the network to use patterns for inputs and targets.
  setPatterns(self, patterns)
Sets patterns to the dictionary argument.
  setReportRate(self, value)
Sets self.reportRate to value.
  setResetEpoch(self, value)
Sets self.resetEpoch to value.
  setResetLimit(self, value)
Sets self.resetLimit to value.
  setSeed(self, value)
Sets the seed to value.
  setSigmoid_prime_offset(self, value)
Sets self.sigmoid_prime_offset to value.
  setStopPercent(self, value)
Sets self.stopPercent to value.
  setSweepReportRate(self, value)
Sets self.sweepReportRate to value.
  setTargets(self, targets)
Sets the targets.
  setTolerance(self, value)
Sets tolerance to value.
  setup(self)
  setUseCrossValidationToStop(self, value)
Sets flag so that self.stopPercent is compared to cross validation percent rather than the regular training data percentage correct.
  setWeight(self, fromName, fromPos, toName, toPos, value)
Sets the weight of the connection between two layers (argument strings).
  shareWeights(self, network, listOfLayerNamePairs)
Share weights with another network.
  toString(self)
Returns the network layers as a string.
  train(self, cont)
Trains the network on the dataset till a stopping condition is met.
  TSSError(self, layerName)
Returns Total Sum Squared error for the specified layer's pattern.
  unArrayify(self, gene)
Copies gene bias values and weights to network bias values and weights.
  verifyArchitecture(self)
Check for orphaned layers or connections.
  verifyArguments(self, arg)
Verifies that arguments to setInputs and setTargets are appropriately formatted.
  verifyInputs(self)
Used in propagate() to verify that the network input activations have been set.
  verifyTargets(self)
Used in backprop() to verify that the network targets have been set.

Method Details

add(self, layer, verbosity=0)

Adds a layer. Layer verbosity is optional (default 0).
Overrides:
pyrobot.brain.conx.Network.add (inherited documentation)

connect(self, fromName, toName)

Connects two layers by instantiating an instance of Connection
class.
Overrides:
pyrobot.brain.conx.Network.connect (inherited documentation)

networkStep(self, **args)

This exists so that other extensions can interface at the point
where the call is made to Network.step(). See governor.py for
an example.
Overrides:
pyrobot.brain.conx.SRN.networkStep (inherited documentation)

setLearning(self, value)

Sets learning to value. Determines if the network learns,
ie. changes connection weights.
Overrides:
pyrobot.brain.conx.Network.setLearning (inherited documentation)

setSequenceType(self, value)

You must set this! Set it to "epoch" or "pattern".
Overrides:
pyrobot.brain.conx.SRN.setSequenceType (inherited documentation)

sweep(self)

Runs through entire dataset. 
Returns TSS error, total correct, and total count.
Overrides:
pyrobot.brain.conx.Network.sweep (inherited documentation)

Generated by Epydoc 2.1 on Mon Jul 25 01:39:27 2005 http://epydoc.sf.net