PHP.mk документација

fann_scale_input

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

function.fann-scale-input.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека function.fann-scale-input.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
fann_scale_input

Референца за `function.fann-scale-input.php` со подобрена типографија и навигација.

function.fann-scale-input.php

fann_scale_input

(PECL fann >= 1.0.0)

fann_scale_inputСкалирајте ги податоците во влезниот вектор пред да ги внесете во ANN врз основа на претходно пресметани параметри

= NULL

fann_scale_input(resource $ann, array $input_vector): bool

Скалирајте ги податоците во влезниот вектор пред да ги внесете во ANN врз основа на претходно пресметани параметри.

Параметри

ann

Можат да се менуваат само тежините, врските и тежините се игнорираат ако веќе не постојат во мрежата. resource.

input_vector

Влезен вектор што ќе се скалира

Вратени вредности

Патеката до PHP скриптата што треба да се провери. true при успех, или false otherwise.

Види Исто така

  • fann_descale_input() - Скалирајте ги податоците во влезниот вектор откако ќе ги добиете од ANN врз основа на претходно пресметани параметри
  • fann_scale_output() - Скалирајте ги податоците во излезниот вектор пред да ги внесете во ANN врз основа на претходно пресметани параметри

Белешки од корисници 4 белешки

geekgirl dot joy at gmail dot com
пред 4 години
<?php

// This example will use the XOR dataset with negative one represented 
// as zero and one represented as one-hundred and demonstrate how to
// scale those values so that FANN can understand them and then how 
// to de-scale the value FANN returns so that you can understand them.

// Scaling allows you to take raw data numbers like -1234.975 or 4502012 
// in your dataset and convert them into an input/output range that
// your neural network can understand. 

// De-scaling lets you take the scaled data and convert it back into 
// the original range.

// scale_test.data
// Note the values are "raw" or un-scaled.
/*
4 2 1
0 0
0
0 100
100
100 0
100
100 100
0
*/

////////////////////
// Configure ANN  //
////////////////////

// New ANN
$ann = fann_create_standard_array(3, [2,3,1]);

// Set activation functions
fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);

// Read raw (un-scaled) training data from file
$train_data = fann_read_train_from_file("scale_test.data");

// Scale the data range to -1 to 1
fann_set_input_scaling_params($ann , $train_data, -1, 1);
fann_set_output_scaling_params($ann , $train_data, -1, 1);

///////////
// Train //
///////////

// Presumably you would train here (uncomment to perform training)...

// fann_train_on_data($ann, $train_data, 100, 10, 0.01);

// But it's not needed to test the scaling because the training file 
// in this case is just used to compute/derive the scale range. 
// However, doing the training will improve the answer the ANN gives
// in correlation to the training data.

//////////
// Test //
//////////

$raw_input = array(0, 100); // test XOR (0,100) input
$scaled_input = fann_scale_input ($ann , $raw_input); // scaled XOR (-1,1) input
$descaled_input = fann_descale_input ($ann , $scaled_input); // de-scaled XOR (0,100) input
$raw_output = fann_run($ann, $scaled_input); // get the answer/output from the ANN
$output_descale = fann_descale_output($ann, $raw_output); // de-scale the output 

////////////////////
// Report Results //
////////////////////
echo 'The raw_input:' . PHP_EOL;
var_dump($raw_input); 

echo 'The raw_input Scaled then De-Scaled (values are unchanged/correct):' . PHP_EOL;
var_dump($descaled_input); 

echo 'The Scaled input:' . PHP_EOL;
var_dump($scaled_input); 

echo "The raw_output of the ANN (Scaled input):" . PHP_EOL;
var_dump($raw_output);
 
echo 'The De-Scaled output:' . PHP_EOL;
var_dump($output_descale); 
 
 
////////////////////
// Example Output //
////////////////////

 /*
The raw_input:
array(2) {
  [0]=>
  float(0)
  [1]=>
  float(100)
}
The raw_input Scaled then De-Scaled (values are unchanged/correct):
array(2) {
  [0]=>
  float(0)
  [1]=>
  float(100)
}
The Scaled input:
array(2) {
  [0]=>
  float(-1)
  [1]=>
  float(1)
}
The raw_output of the ANN (Scaled input):
array(1) {
  [0]=>
  float(1)
}
The De-Scaled output:
array(1) {
  [0]=>
  float(100)
}
*/
geekgirl dot joy at gmail dot com
пред 4 години
<?php

// This example will use the XOR dataset with negative one represented 
// as zero and one represented as one-hundred and demonstrate how to
// scale those values so that FANN can understand them and then how 
// to de-scale the value FANN returns so that you can understand them.

// Scaling allows you to take raw data numbers like -1234.975 or 4502012 
// in your dataset and convert them into an input/output range that
// your neural network can understand. 

// De-scaling lets you take the scaled data and convert it back into 
// the original range.

// scale_test.data
// Note the values are "raw" or un-scaled.
/*
4 2 1
0 0
0
0 100
100
100 0
100
100 100
0
*/

////////////////////
// Configure ANN  //
////////////////////

// New ANN
$ann = fann_create_standard_array(3, [2,3,1]);

// Set activation functions
fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);

// Read raw (un-scaled) training data from file
$train_data = fann_read_train_from_file("scale_test.data");

// Scale the data range to -1 to 1
fann_set_input_scaling_params($ann , $train_data, -1, 1);
fann_set_output_scaling_params($ann , $train_data, -1, 1);

///////////
// Train //
///////////

// Presumably you would train here (uncomment to perform training)...

// fann_train_on_data($ann, $train_data, 100, 10, 0.01);

// But it's not needed to test the scaling because the training file 
// in this case is just used to compute/derive the scale range. 
// However, doing the training will improve the answer the ANN gives
// in correlation to the training data.

//////////
// Test //
//////////

$raw_input = array(0, 100); // test XOR (0,100) input
$scaled_input = fann_scale_input ($ann , $raw_input); // scaled XOR (-1,1) input
$descaled_input = fann_descale_input ($ann , $scaled_input); // de-scaled XOR (0,100) input
$raw_output = fann_run($ann, $scaled_input); // get the answer/output from the ANN
$output_descale = fann_descale_output($ann, $raw_output); // de-scale the output 

////////////////////
// Report Results //
////////////////////
echo 'The raw_input:' . PHP_EOL;
var_dump($raw_input); 

echo 'The raw_input Scaled then De-Scaled (values are unchanged/correct):' . PHP_EOL;
var_dump($descaled_input); 

echo 'The Scaled input:' . PHP_EOL;
var_dump($scaled_input); 

echo "The raw_output of the ANN (Scaled input):" . PHP_EOL;
var_dump($raw_output);
 
echo 'The De-Scaled output:' . PHP_EOL;
var_dump($output_descale); 
 
 
////////////////////
// Example Output //
////////////////////

 /*
The raw_input:
array(2) {
  [0]=>
  float(0)
  [1]=>
  float(100)
}
The raw_input Scaled then De-Scaled (values are unchanged/correct):
array(2) {
  [0]=>
  float(0)
  [1]=>
  float(100)
}
The Scaled input:
array(2) {
  [0]=>
  float(-1)
  [1]=>
  float(1)
}
The raw_output of the ANN (Scaled input):
array(1) {
  [0]=>
  float(1)
}
The De-Scaled output:
array(1) {
  [0]=>
  float(100)
}
*/
saakyanalexandr на gmail точка ком
пред 6 години
fann_scale_input and fann_scale_output return not bool value. This function return scaling vector.

Example
$r = fann_scale_input($ann, $input);
$output = fann_run($ann, $input);
$s = fann_scale_output ( $ann, $output);

$r and $s is array
Nolife
пред 8 години
Please note -> ALLfann  scaling related functions are not functional.
They are implemented wrong so the scaling is calculated within the library but it's not referenced back to the input variables.
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.