1 |
(****************************************************************** |
(****************************************************************** |
2 |
[LibNN - Neural Networks Library] |
[LibNN - Neural Networks Library] |
3 |
Copyright (C) 2002 - 2003 LAGACHERIE Matthieu RICORDEAU Olivier |
Copyright (C) 2002 - 2003 LAGACHERIE Matthieu RICORDEAU Olivier |
4 |
|
|
5 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
6 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
7 |
as published by the Free Software Foundation; either version 2 |
as published by the Free Software Foundation; either version 2 |
8 |
of the License, or (at your option) any later version. This |
of the License, or (at your option) any later version. This |
9 |
program is distributed in the hope that it will be useful, |
program is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. You should have |
GNU General Public License for more details. You should have |
13 |
received a copy of the GNU General Public License |
received a copy of the GNU General Public License |
14 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
15 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
16 |
USA. |
USA. |
17 |
|
|
18 |
Author: |
Authors: |
19 |
LAGACHERIE Matthieu |
LAGACHERIE Matthieu |
20 |
Paper mail : 7 rue Delescluzes 94280 LE KREMLIN BICETRE, FRANCE |
Paper mail : 7 rue Delescluzes 94280 LE KREMLIN BICETRE, FRANCE |
21 |
E-mail : matthieu@marvinproject.org |
E-mail : matthieu@marvinproject.org |
22 |
|
|
23 |
RICORDEAU Olivier |
RICORDEAU Olivier |
24 |
Paper mail : 69 avenue d'Italie 75013 PARIS, FRANCE |
Paper mail : 69 avenue d'Italie 75013 PARIS, FRANCE |
25 |
E-mail : olivier@marvinproject.org |
E-mail : olivier@marvinproject.org |
26 |
|
|
27 |
*****************************************************************) |
*****************************************************************) |
28 |
|
|
29 |
|
|
30 |
(** The class Pattern |
(** |
31 |
|
The Pattern class. |
32 |
|
|
33 |
@author Matthieu Lagacherie |
@author Matthieu Lagacherie |
34 |
@author Olivier Ricordeau |
@author Olivier Ricordeau |
35 |
|
@since 07/08/2003 |
36 |
|
@param 'a A class parameter. It's actually a pattern object. |
37 |
|
@see 'corpus.ml' A corpus is a set of patterns. |
38 |
*) |
*) |
39 |
|
|
40 |
class ['a] pattern (inputVector : 'a) (outputVector : 'a) = |
class ['a] pattern (inputVector : 'a) (outputVector : 'a) = |
41 |
object |
object |
42 |
|
|
43 |
val mutable _inputs = inputVector |
val mutable _inputs = inputVector |
44 |
|
|
45 |
val mutable _outputs = outputVector |
val mutable _outputs = outputVector |
46 |
|
|
47 |
(* initializer match (inputVector, outputVector) with |
(* initializer match (inputVector, outputVector) with |
48 |
a, b when Array.length a != 0 && Array.length b != 0 -> () |
a, b when Array.length a != 0 && Array.length b != 0 -> () |
49 |
| _, _ -> (Env.getEnv())#toChannel "Class Pattern : The input and output are empty.\n" *) |
| _, _ -> (Env.getEnv())#toChannel "Class Pattern : The input and output are empty.\n" *) |
50 |
|
|
51 |
method getInputs = _inputs |
method getInputs = _inputs |
52 |
|
|
53 |
method getOutputs = _outputs |
method getOutputs = _outputs |
54 |
|
|
55 |
method getInput index = _inputs.(index) |
method getInput index = _inputs.(index) |
56 |
|
|
57 |
method getOutput index = _outputs.(index) |
method getOutput index = _outputs.(index) |
58 |
|
|
59 |
method getVectorNumber = Array.length _inputs |
method getVectorNumber = Array.length _inputs |
60 |
|
|
61 |
method getInputSize = Array.length _inputs.(0) |
method getInputSize = Array.length _inputs.(0) |
62 |
|
|
63 |
method getOutputSize = Array.length _outputs.(0) |
method getOutputSize = Array.length _outputs.(0) |
64 |
|
|
65 |
end |
end |