module Ann_patterns: sig
.. end
Patterns for neural networks.
This module allows to read pattern files, print patterns, read and normalize
network's inputs.
val read_patterns : int -> int -> string -> int list option -> (float array * float array) array
read_patterns dim_x dim_y filename columns
reads a patterns file
and returns them as an array of couples (x,t)
where
x
is an input vector of dimension dim_x
, and t
is a target
vector of dimension dim_y
.
The file filename
should be made such that each vector x
is followed
on the same line by the target vector t
.
If columns
is the option None
, then all columns of the file are used
to build the input vectors. Otherwise, columns
may be an option Some l
where l
is a selection of columns tu use as input (list of integers,
first columns being indexed 0).
The target vectors are always the last dim_y
columns.
val fprint_pattern : out_channel -> float array * float array -> unit
fprint_pattern ch (x,t)
prints the input vector x
and the
target vector t
and channel ch
.
val stats : (float array * 'a) array -> float array * float array
stats patterns
returns the mean value and standard deviation of
the input vectors of patterns
val normalize : (float array * 'a) array -> (float array * 'a) array
normalize patterns
normalizes the input vectors by removing the
average value and dividing by the standard deviation.
It returns a fresh array of patterns.
val read_inputs : int -> string -> int list option -> float array array
read_inputs dim_x filename columns
reads a file of input vectors
of dimension dim_x
, from a file filename
. If columns
is the
option None
, then all columns of the file are used to build the input
vectors. Otherwise, columns
may be an option Some l
where l
is a
selection of columns tu use as input (list of integers, first columns
being indexed 0).
The function returns an array of input vectors (as float arrays)