nnfwlibinitializer.cpp
1 /********************************************************************************
2  * Neural Network Framework. *
3  * Copyright (C) 2005-2011 Gianluca Massera <emmegian@yahoo.it> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the Free Software *
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
18  ********************************************************************************/
19 
20 #include "nnfwconfig.h"
21 #include "simplecluster.h"
22 #include "biasedcluster.h"
23 #include "ddecluster.h"
24 #include "fakecluster.h"
25 #include "copylinker.h"
26 #include "dotlinker.h"
27 #include "normlinker.h"
28 #include "liboutputfunctions.h"
29 #include "libperiodicfunctions.h"
30 #include "libradialfunctions.h"
32 #include "learningalgorithm.h"
33 #include "backpropagationalgo.h"
34 #include "factory.h"
35 #include "logger.h"
36 
37 #include <QStringList>
38 #include <QDebug>
39 
40 namespace farsa {
41 
42 bool FARSA_NNFW_API initNNFWLib() {
43  static bool dummy = false;
44  if ( dummy ) return true;
45  // Registering all types to factory
46  Factory::getInstance().registerClass<NeuralNet>("NeuralNet", "ParameterSettableWithConfigureFunction");
47  Factory::getInstance().registerClass<Pattern>("Pattern", "ParameterSettableWithConfigureFunction");
48  Factory::getInstance().registerClass<LearningAlgorithm>("LearningAlgorithm", "ParameterSettableWithConfigureFunction");
49  Factory::getInstance().registerClass<BackPropagationAlgo>("BackPropagationAlgo", "LearningAlgorithm");
50  // Clusters
51  Factory::getInstance().registerClass<Updatable>("Updatable", "ParameterSettableInConstructor");
52  Factory::getInstance().registerClass<Cluster>("Cluster", "Updatable");
53  Factory::getInstance().registerClass<SimpleCluster>("SimpleCluster", "Cluster");
54  Factory::getInstance().registerClass<BiasedCluster>("BiasedCluster", "Cluster");
55  Factory::getInstance().registerClass<DDECluster>("DDECluster", "Cluster");
56  Factory::getInstance().registerClass<FakeCluster>("FakeCluster", "Cluster");
57 
58  // Linkers
59  Factory::getInstance().registerClass<Linker>("Linker", "Updatable");
60  Factory::getInstance().registerClass<CopyLinker>("CopyLinker", "Linker");
61  Factory::getInstance().registerClass<MatrixLinker>("MatrixLinker", "Linker");
62  Factory::getInstance().registerClass<DotLinker>("DotLinker", "MatrixLinker");
63  Factory::getInstance().registerClass<NormLinker>("NormLinker", "MatrixLinker");
64 
65  // Output Functions
66  Factory::getInstance().registerClass<OutputFunction>("OutputFunction", "ParameterSettableWithConfigureFunction");
67 
68  Factory::getInstance().registerClass<FakeSigmoidFunction>("FakeSigmoidFunction", "OutputFunction");
69  Factory::getInstance().registerClass<IdentityFunction>("IdentityFunction", "OutputFunction");
70  Factory::getInstance().registerClass<GainFunction>("GainFunction", "OutputFunction");
71  Factory::getInstance().registerClass<LinearFunction>("LinearFunction", "OutputFunction");
72  Factory::getInstance().registerClass<RampFunction>("RampFunction", "OutputFunction");
73  Factory::getInstance().registerClass<ScaleFunction>("ScaleFunction", "OutputFunction");
74  Factory::getInstance().registerClass<ScaledSigmoidFunction>("ScaledSigmoidFunction", "OutputFunction");
75  Factory::getInstance().registerClass<SigmoidFunction>("SigmoidFunction", "OutputFunction");
76  Factory::getInstance().registerClass<StepFunction>("StepFunction", "OutputFunction");
77  Factory::getInstance().registerClass<LeakyIntegratorFunction>("LeakyIntegratorFunction", "OutputFunction");
78  Factory::getInstance().registerClass<LogLikeFunction>("LogLikeFunction", "OutputFunction");
79  Factory::getInstance().registerClass<CompositeFunction>("CompositeFunction", "OutputFunction");
80  Factory::getInstance().registerClass<LinearComboFunction>("LinearComboFunction", "OutputFunction");
81  Factory::getInstance().registerClass<GaussFunction>("GaussFunction", "OutputFunction");
82  Factory::getInstance().registerClass<PeriodicFunction>("PeriodicFunction", "OutputFunction");
83  Factory::getInstance().registerClass<PseudoGaussFunction>("PseudoGaussFunction", "PeriodicFunction");
84  Factory::getInstance().registerClass<SawtoothFunction>("SawtoothFunction", "PeriodicFunction");
85  Factory::getInstance().registerClass<SinFunction>("SinFunction", "PeriodicFunction");
86  Factory::getInstance().registerClass<TriangleFunction>("TriangleFunction", "PeriodicFunction");
87  Factory::getInstance().registerClass<WinnerTakeAllFunction>("WinnerTakeAllFunction", "OutputFunction");
88  dummy = true;
89  Logger::info( "Library NNFW Initialized" );
90  return true;
91 }
92 
93 }