コード例 #1
0
ファイル: fann.class.php プロジェクト: 0-php/AI
 /**
  * Train ANN with all data given from training file
  * @param string filename with absolute path
  * @param int max epochs to train
  * @param float desired error
  * @return bool true on success, false on error
  */
 public function train_on_file($path, $max_epochs, $desired_error)
 {
     $this->checkIfAnnIsAssigned();
     return fann_train_on_file($this->annId, $path, $max_epochs, $desired_error);
 }
コード例 #2
0
ファイル: Extfann.01.php プロジェクト: exakat/exakat
<?php

$num_input = 2;
$num_output = 1;
$num_layers = 3;
$num_neurons_hidden = 3;
$desired_error = 0.001;
$max_epochs = 500000;
$epochs_between_reports = 1000;
$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);
if ($ann) {
    fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
    fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);
    $filename = dirname(__FILE__) . "/xor.data";
    if (fann_train_on_file($ann, $filename, $max_epochs, $epochs_between_reports, $desired_error)) {
        fann_save($ann, dirname(__FILE__) . "/xor_float.net");
    }
    fann_destroy($ann);
}
コード例 #3
0
<?php

namespace MachineLearning;

include 'Util/Input.php';
include 'Util/Output.php';
$numLayers = 3;
$numInput = Util\Input::NUM_INPUT;
$numNeuronsHidden = 9;
$numOutput = Util\Output::NUM_OUTPUT;
$maxEpochs = 500000;
$epochsBetweenReports = 1000;
$desiredError = 0.001;
$ann = fann_create_standard($numLayers, $numInput, $numNeuronsHidden, $numOutput);
if ($ann) {
    fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
    fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);
    if (fann_train_on_file($ann, 'Data/training', $maxEpochs, $epochsBetweenReports, $desiredError)) {
        fann_save($ann, 'Data/training_result');
    }
    fann_destroy($ann);
}
コード例 #4
0
 /**
  * Train On File.
  * 
  * @param  int   $maxEpochs            The maximum number of epochs the training should continue.
  * @param  int   $epochsBetweenReports The number of epochs between calling a user function.
  *                                     A value of zero means that user function is not called. 
  * @param  float $desiredError         The desired fann_get_MSE() or fann_get_bit_fail(), 
  *                                     depending on the stop function chosen by 
  *                                     fann_set_train_stop_function().
  * @return bool
  */
 public function trainOnFile($maxEpochs, $epochsBetweenReports, $desiredError)
 {
     $result = fann_train_on_file($this->ann, $this->trainFile, $maxEpochs, $epochsBetweenReports, $desiredError);
     return $result;
 }
コード例 #5
0
 public function trainOnFile($filename, $maxEpochs, $epochsBetweenReports, $desiredError)
 {
     $this->updateTrainingsCount();
     return fann_train_on_file($this->ann, $filename, $maxEpochs, $epochsBetweenReports, $desiredError);
 }