-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18967c5
commit 259d076
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |