00001
00002 #ifndef _NNET_SET_H_
00003 #define _NNET_SET_H_
00004
00005 #include <math.h>
00006 #include <vector>
00007 #include <iostream>
00008 #include "Object.h"
00009 #include "FFNet.h"
00010
00011 namespace FD {
00012
00013 class NNetSet;
00014
00015 std::ostream &operator << (std::ostream &out, const NNetSet &cell);
00016
00017
00018 class NNetSet : public Object {
00019 protected:
00020 std::vector<RCPtr<FFNet> > nets;
00021 float *value;
00022 public:
00023
00024
00025
00026 NNetSet(){value = NULL;}
00027
00028 NNetSet (const NNetSet &) {std::cerr << "don't call the NNetSet copy constructor\n"; exit(1);}
00029
00030 NNetSet(int nbNets, const Vector<int> &topo, const Vector<std::string> &functions, std::vector<int> id, std::vector<float *> &tin, std::vector<float *> &tout);
00031
00032 NNetSet(std::vector<int> id, std::vector<float *> &tin, std::vector<float *> &tout, NNetSet *net1, NNetSet *net2);
00033
00034 ~NNetSet()
00035 {
00036 delete [] value;
00037 }
00038
00039 float *calc(int id, const float *input);
00040
00041
00042
00043
00044 void trainDeltaBar(std::vector<int> id, std::vector<float *> tin, std::vector<float *> tout,
00045 int iter, double learnRate, double increase, double decrease);
00046
00047
00048
00049
00050 void printOn(std::ostream &out) const;
00051
00052 void readFrom (std::istream &in);
00053
00054 friend std::istream &operator >> (std::istream &in, NNetSet &cell);
00055 };
00056
00057 }
00058
00059 #endif