Module Nn.Net

Generic networks.

module Layer : sig ... end

Layers of a net.

type t = {
  1. layers : Layer.t list;
}
val src : t -> int
val tgt : t -> int
val make : Layer.t list -> t

Create a network from a list of layers.

val append : t -> t -> t

Append two networks.

val neural : ?activation:[< `ReLU | `Sigmoid Sigmoid ] -> rate:float -> int list -> t

Create a neural network with given arities for the layers and convergence rate.

val predict : t -> Vector.t -> Vector.t

Compute the output of a network on a given input.

val forward : t -> Vector.t -> (Vector.t * Layer.t) list * Vector.t

Forward propagation: returns layers decorated with their input, as well as the global output.

val backward : t -> Vector.t -> float

Backward propagation. Returns the previously computed error.

val fit : ?distance:[ `Euclidean ] -> t -> (Vector.t * Vector.t) list -> unit

Train a network on given data.