Skip to content

Commit

Permalink
Create train_dui.php
Browse files Browse the repository at this point in the history
  • Loading branch information
geekgirljoy authored May 20, 2019
1 parent 18967c5 commit 259d076
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions train_dui.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
$num_input = 27;
$num_output = 26;
$num_layers = 3;
$num_neurons_hidden = 16;
$desired_error = 0.00001;
$max_epochs = 500000;
$epochs_between_reports = 10;
$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);
if ($ann) {

// Configure the ANN
fann_set_training_algorithm ($ann , FANN_TRAIN_RPROP);
fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);

// Train ANN
$filename = dirname(__FILE__) . "/DUI.data";
if (fann_train_on_file($ann, $filename, $max_epochs, $epochs_between_reports, $desired_error)) {
print('DUI trained.' . PHP_EOL);
}

// Save ANN
if (fann_save($ann, dirname(__FILE__) . "/dui.net")){
echo 'dui.net saved. run: php test_dui.php' . PHP_EOL;
}

// Destron ANN
fann_destroy($ann);
}

0 comments on commit 259d076

Please sign in to comment.