37 |
|
|
38 |
(** |
(** |
39 |
The errorCommonVisitor class |
The errorCommonVisitor class |
|
Computes each neurone's output error. |
|
40 |
|
|
41 |
@author Matthieu Lagacherie |
@author Matthieu Lagacherie |
42 |
@author Olivier Ricordeau |
@author Olivier Ricordeau |
48 |
open DefaultVisitor |
open DefaultVisitor |
49 |
open MlpNN |
open MlpNN |
50 |
|
|
51 |
|
(** |
52 |
|
Computes each neurone's output error in a Multi-Layer Perceptron. |
53 |
|
*) |
54 |
class errorMlpnnVisitor = |
class errorMlpnnVisitor = |
55 |
object |
object |
56 |
inherit [mlpNN] errorVisitor |
inherit [mlpNN] errorVisitor |
57 |
|
|
58 |
|
(** |
59 |
|
The transfer function. |
60 |
|
*) |
61 |
val mutable _transfertFunction = function x |
val mutable _transfertFunction = function x |
62 |
-> (1. /. (1. +. exp (-.x))) |
-> (1. /. (1. +. exp (-.x))) |
63 |
|
|
64 |
|
(** |
65 |
|
This function is the derivate of the transfer function above. |
66 |
|
*) |
67 |
val mutable _derivateFunction = function x |
val mutable _derivateFunction = function x |
68 |
-> (((1. /. (1. +. exp (-.x)))) *. (1. -. (1. /. (1. +. exp (-.x))))) |
-> (((1. /. (1. +. exp (-.x)))) *. (1. -. (1. /. (1. +. exp (-.x))))) |
69 |
|
|
70 |
|
(** |
71 |
|
The generic "visit" method |
72 |
|
*) |
73 |
method visit (network : mlpNN) = |
method visit (network : mlpNN) = |
74 |
let error = network#getError and |
let error = network#getError and |
75 |
gradients = network#getGradients and |
gradients = network#getGradients and |