Reads a file that stores training data

- « fann_randomize_weights

- fann_reset_errno »

- PHP Manual
- Fann Functions
- Reads a file that stores training data

# fann_read_train_from_file

(PECL fann >= 1.0.0)

fann_read_train_from_file — Reads a file that stores training data

### Description

fann_read_train_from_file(string `$filename`): resource

Reads a file that stores training data.

### Parameters

`filename`

  The input file in the following format:

      num_train_data num_input num_output
      inputdata separated by space
      outputdata separated by space

      .
      .
      .

      inputdata separated by space
      outputdata separated by space

### Return Values

Returns a train data resource on success, or `false` on error.

### Examples

Example #1 fann_read_train_from_file() example

    <?php$train_data = fann_read_train_from_file("xor.data");if ($train_data) {    // Do something with $train_data for XOR function}?>

Contents of xor.data

    4 2 1
    -1 -1
    -1
    -1 1
    1
    1 -1
    1
    1 1
    -1

### See Also

- fann_train_on_data() - Trains on an entire dataset for a period of time
- fann_destroy_train() - Destructs the training data
- fann_save_train() - Save the training structure to a file