Class ANN_Network

Description
  • access: public

Located in /Network.php (line 51)

ANN_Filesystem
   |
   --ANN_Network
Class Constant Summary
Method Summary
[659]   protected   static   string :  getDefaultFilename ()
[1012]   public   static   void :  loadFromFile ([string $strFilename = null])
[1284]   public   static   ANN_Network :  loadFromHost (string $strUsername, string $strPassword, string $strHost)
[115]   public   ANN_Network :  __construct ([integer $intNumberOfHiddenLayers = 1], [integer $intNumberOfNeuronsPerLayer = 6], [integer $intNumberOfOutputs = 1])
[349]   protected   void :  activate ()
[969]   protected   void :  calculateMaxTrainingLoops ()
[309]   protected   void :  createHiddenLayers (integer $intNumberOfHiddenLayers, integer $intNumberOfNeuronsPerLayer)
[336]   protected   void :  createOutputLayer (integer $intNumberOfOutputs)
[1316]   protected   void :  detectOutputType ()
[615]   protected   integer :  getCountInputs ()
[1196]   protected   float :  getNetworkError ()
[449]   protected   integer :  getNextIndexInputsToTrain ([boolean $boolReset = FALSE])
[1057]   public   integer :  getNumberHiddenLayers ()
[1071]   public   integer :  getNumberHiddens ()
[1042]   public   integer :  getNumberInputs ()
[1086]   public   integer :  getNumberOutputs ()
[247]   public   array :  getOutputs ()
[285]   public   array :  getOutputsByInputKey (integer $intKeyInput)
[478]   public   integer :  getTotalLoops ()
[489]   protected   boolean :  isEpoch ()
[533]   protected   boolean :  isTrainingComplete ()
[565]   protected   boolean :  isTrainingCompleteByEpoch ()
[582]   protected   boolean :  isTrainingCompleteByInputKey (integer $intKeyInput)
[1178]   protected   void :  logNetworkErrors ()
[1123]   public   void :  logNetworkErrorsToFile (string $strFilename)
[1141]   protected   void :  logWeights ()
[1104]   public   void :  logWeightsToFile (string $strFilename)
[701]   public   void :  printNetwork ([integer $intLevel = 2])
[769]   protected   void :  printNetworkDetails1 ()
[878]   protected   void :  printNetworkDetails2 ()
[1028]   public   void :  saveToFile ([string $strFilename = null])
[1254]   public   void :  saveToHost (string $strUsername, string $strPassword, string $strHost)
[145]   protected   void :  setInputs (array $arrInputs)
[224]   protected   void :  setInputsToTrain (array $arrInputs)
[515]   public   void :  setLearningRate ([float $floatLearningRate = 0.7])
[983]   public   void :  setMaxTrainingLoopsFactor ([integer $intMaxTrainingLoopsFactor = 230])
[1338]   public   void :  setOutputErrorTolerance ([float $floatOutputErrorTolerance = 0.02])
[169]   protected   void :  setOutputs (array $arrOutputs)
[672]   protected   void :  setOutputType ([integer $intType = self::OUTPUT_LINEAR])
[210]   public   void :  setValues (ANN_Values $objValues)
[382]   public   boolean :  train ()
[1219]   public   ANN_Network :  trainByHost (string $strUsername, string $strPassword, string $strHost)
[634]   protected   void :  training (array $arrOutputs)
[997]   public   void :  __wakeup ()
Methods
protected static string getDefaultFilename () [659]
  • return: Filename
  • access: protected
public static void loadFromFile ([string $strFilename = null]) [1012]
  • string $strFilename: (Default: null)

Redefinition of:
ANN_Filesystem::loadFromFile()
public static ANN_Network loadFromHost (string $strUsername, string $strPassword, string $strHost) [1284]
  • throws: ANN_Exception
  • access: public
  • string $strUsername
  • string $strPassword
  • string $strHost
public  ANN_Network __construct ([integer $intNumberOfHiddenLayers = 1], [integer $intNumberOfNeuronsPerLayer = 6], [integer $intNumberOfOutputs = 1]) [115]
  • integer $intNumberOfHiddenLayers: (Default: 1)
  • integer $intNumberOfNeuronsPerLayer: (Default: 6)
  • integer $intNumberOfOutputs: (Default: 1)
protected  void activate () [349]
protected  void calculateMaxTrainingLoops () [969]
protected  void createHiddenLayers (integer $intNumberOfHiddenLayers, integer $intNumberOfNeuronsPerLayer) [309]
  • integer $intNumberOfHiddenLayers
  • integer $intNumberOfNeuronsPerLayer
protected  void createOutputLayer (integer $intNumberOfOutputs) [336]
  • integer $intNumberOfOutputs
protected  void detectOutputType () [1316]
protected  integer getCountInputs () [615]
protected  float getNetworkError () [1196]
protected  integer getNextIndexInputsToTrain ([boolean $boolReset = FALSE]) [449]
  • boolean $boolReset: (Default: FALSE)
public  integer getNumberHiddenLayers () [1057]
public  integer getNumberHiddens () [1071]
public  integer getNumberInputs () [1042]
public  integer getNumberOutputs () [1086]
public  array getOutputs () [247]

Get the output values

Get the output values to the related input values set by setValues(). This method returns the output values as a two-dimensional array.

public  array getOutputsByInputKey (integer $intKeyInput) [285]
  • integer $intKeyInput
public  integer getTotalLoops () [478]
  • access: public
protected  boolean isEpoch () [489]
protected  boolean isTrainingComplete () [533]
protected  boolean isTrainingCompleteByEpoch () [565]
protected  boolean isTrainingCompleteByInputKey (integer $intKeyInput) [582]
  • integer $intKeyInput
protected  void logNetworkErrors () [1178]
public  void logNetworkErrorsToFile (string $strFilename) [1123]

Log network errors while training in CSV format

  • string $strFilename
protected  void logWeights () [1141]
public  void logWeightsToFile (string $strFilename) [1104]

Log weights while training in CSV format

  • string $strFilename
public  void printNetwork ([integer $intLevel = 2]) [701]
  • integer $intLevel: (0, 1, 2) (Default: 2)
protected  void printNetworkDetails1 () [769]
protected  void printNetworkDetails2 () [878]
public  void saveToFile ([string $strFilename = null]) [1028]
  • string $strFilename: (Default: null)

Redefinition of:
ANN_Filesystem::saveToFile()
public  void saveToHost (string $strUsername, string $strPassword, string $strHost) [1254]
  • throws: ANN_Exception
  • access: public
  • string $strUsername
  • string $strPassword
  • string $strHost
protected  void setInputs (array $arrInputs) [145]
  • array $arrInputs
protected  void setInputsToTrain (array $arrInputs) [224]
  • array $arrInputs
public  void setLearningRate ([float $floatLearningRate = 0.7]) [515]

Setting the learning rate

  • throws: ANN_Exception
  • access: public
  • uses: ANN_Exception::__construct()
  • float $floatLearningRate: (Default: 0.7) (0.1 .. 0.9)
public  void setMaxTrainingLoopsFactor ([integer $intMaxTrainingLoopsFactor = 230]) [983]
  • throws: ANN_Exception
  • access: public
  • integer $intMaxTrainingLoopsFactor: (Default: 230)
public  void setOutputErrorTolerance ([float $floatOutputErrorTolerance = 0.02]) [1338]

Setting the percentage of output error in comparison to the desired output

  • access: public
  • float $floatOutputErrorTolerance: (Default: 0.02)
protected  void setOutputs (array $arrOutputs) [169]
  • array $arrOutputs
protected  void setOutputType ([integer $intType = self::OUTPUT_LINEAR]) [672]
  • integer $intType: (Default: ANN_Network::OUTPUT_LINEAR)
public  void setValues (ANN_Values $objValues) [210]

Set Values for training or using network

Set Values of inputs and outputs for training or just inputs for using already trained network.

  1.  $objNetwork new ANN_Network(241);
  2.  
  3.  $objValues new ANN_Values;
  4.  
  5.  $objValues->train()
  6.            ->input(0.120.110.15)
  7.            ->output(0.56);
  8.  
  9.  $objNetwork->setValues($objValues);

public  ANN_Network trainByHost (string $strUsername, string $strPassword, string $strHost) [1219]
  • throws: ANN_Exception
  • access: public
  • string $strUsername
  • string $strPassword
  • string $strHost
protected  void training (array $arrOutputs) [634]
  • array $arrOutputs
public  void __wakeup () [997]

Inherited Methods

Inherited From ANN_Filesystem

ANN_Filesystem::loadFromFile()
ANN_Filesystem::saveToFile()
Class Constants
OUTPUT_BINARY = 2 (line 100)

Binary output type

OUTPUT_LINEAR = 1 (line 94)

Linear output type

Documentation generated on Wed, 06 Jan 2010 19:14:56 +0100 by phpDocumentor 1.4.1