Example #1
0
 /**
  * Train On File.
  * 
  * @return bool
  */
 public function trainOnFile()
 {
     $maxEpochs = 500000;
     $epochsBetweenReports = 1000;
     $desiredError = 0.001;
     $result = $this->neuralNetwork->trainOnFile($maxEpochs, $epochsBetweenReports, $desiredError);
     if ($result === false) {
         throw new RuntimeException(sprintf("Failed to train neural network on file: %s", $this->neuralNetwork->getConfigurationFile()), 1);
     }
     $result = $this->neuralNetwork->save();
     if ($result === false) {
         throw new RuntimeException(sprintf("Failed to save neural network to file: %s", $this->neuralNetwork->getConfigurationFile()), 1);
     }
     return $result;
 }