⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simulate.h

📁 一个人工神经网络的程序。 文档等说明参见http://aureservoir.sourceforge.net/
💻 H
📖 第 1 页 / 共 2 页
字号:
                        typename ESN<T>::DEMatrix &out);  /// the filter object  BPFilter<T> filter_;};/*! * \class SimFilter * * \brief algorithm with general IIR-Filter neurons * * This is an extension of the bandpass style neurons to general n-order * IIR-filter neurons. * \sa class SimBP * * The IIR Filter is implemented in Transposed Direct Form 2, * which has good numeric stability properties. It is also possible to cascade * multiple IIR Filters in serie, for better numerical performance. * \sa http://ccrma.stanford.edu/~jos/filters/Transposed_Direct_Forms.html * * The filter calculates the following difference equation (same usage as * Matlab's filter object): * a[0]*y[n] = b[0]*x[n] + b[1]*x[n-1] + ... + b[nb]*x[n-nb] *                       - a[1]*y[n-1] - ... - a[na]*y[n-na] * where y is the new calculated activation after the filter and x is the * input to the filter. * The filter is always calculated _after_ the nonlinearity. * \sa class IIRFilter * * See "Echo State Networks with Filter Neurons and a Delay&Sum Readout" * (Georg Holzmann, 2008). * \sa http://grh.mur.at/misc/ESNsWithFilterNeuronsAndDSReadout.pdf * * \example "multiple_sines.py" */template <typename T>class SimFilter : public SimBase<T>{  using SimBase<T>::esn_;  using SimBase<T>::last_out_;  using SimBase<T>::t_; public:  SimFilter(ESN<T> *esn) : SimBase<T>(esn) {}  virtual ~SimFilter() {}  /// virtual constructor idiom  virtual SimFilter<T> *clone(ESN<T> *esn) const  {    SimFilter<T> *new_obj = new SimFilter<T>(esn);    new_obj->t_ = t_; new_obj->last_out_ = last_out_;    new_obj->filter_ = filter_;    return new_obj;  }  /**   * sets the filter coefficients   * @param B matrix with numerator coefficient vectors (m x nb)   *          m  ... nr of parallel filters (neurons)   *          nb ... nr of filter coefficients   * @param A matrix with denominator coefficient vectors (m x na)   *          m  ... nr of parallel filters (neurons)   *          na ... nr of filter coefficients   * @param seris nr of serial IIR filters, e.g. if series=2 the coefficients   *              B and A will be divided in its half and calculated with   *              2 serial IIR filters   */  virtual void setIIRCoeff(const typename DEMatrix<T>::Type &B,                   const typename DEMatrix<T>::Type &A,                   int series=1) throw(AUExcept);  /// implementation of the algorithm  /// \sa class SimBase::simulate  virtual void simulate(const typename ESN<T>::DEMatrix &in,                        typename ESN<T>::DEMatrix &out);  /// the filter object  SerialIIRFilter<T> filter_;};/*! * \class SimFilter2 * * \brief algorithm with IIR-Filter before neuron nonlinearity * * This version is similar to SimFilter, but calculates the filtering * _before_ the nonlinearity of the reservoir neurons on input, feedback * and the network states. * \sa class SimFilter * \sa class IIRFilter */template <typename T>class SimFilter2 : public SimFilter<T>{  using SimBase<T>::esn_;  using SimBase<T>::last_out_;  using SimBase<T>::t_;  using SimFilter<T>::filter_; public:  SimFilter2(ESN<T> *esn) : SimFilter<T>(esn) {}  virtual ~SimFilter2() {}  /// virtual constructor idiom  virtual SimFilter2<T> *clone(ESN<T> *esn) const  {    SimFilter2<T> *new_obj = new SimFilter2<T>(esn);    new_obj->t_ = t_; new_obj->last_out_ = last_out_;    new_obj->filter_ = filter_;    return new_obj;  }  /// implementation of the algorithm  /// \sa class SimBase::simulate  virtual void simulate(const typename ESN<T>::DEMatrix &in,                        typename ESN<T>::DEMatrix &out);};/*! * \class SimFilterDS * * \brief IIR-Filter neurons with additional delay&sum readout * * This version works like SimFilter, but has an additional delay&sum readout, * which means that not only a single weight but also a delay is learned * in the readout. Therefore it can be used to identify systems with * long-term dependencies. * \sa class SimFilter * \sa class IIRFilter * * See "Echo State Networks with Filter Neurons and a Delay&Sum Readout" * (Georg Holzmann, 2008). * \sa http://grh.mur.at/misc/ESNsWithFilterNeuronsAndDSReadout.pdf * * \example "singleneuron_sinosc.py" * \example "multiple_sines.py" * \example "sparse_nonlin_system_identification.py" */template <typename T>class SimFilterDS : public SimFilter<T>{  using SimBase<T>::esn_;  using SimBase<T>::last_out_;  using SimBase<T>::t_;  using SimFilter<T>::filter_; public:  SimFilterDS(ESN<T> *esn) : SimFilter<T>(esn) {}  virtual ~SimFilterDS() {}  /// virtual constructor idiom  virtual SimFilterDS<T> *clone(ESN<T> *esn) const  {    SimFilterDS<T> *new_obj = new SimFilterDS<T>(esn);    new_obj->t_ = t_; new_obj->last_out_ = last_out_;    new_obj->filter_ = filter_; new_obj->dellines_ = dellines_;    new_obj->intmp_ = intmp_;    return new_obj;  }  /// reallocates data buffers  virtual void reallocate();  /**   * initializes the delay lines from each neuron+input to all outputs   * @param index which delayline to init, reservoir neurons are first,   *              then inputs, then to all outputs.   *              index starts from 0 !!!   * @param initbuf initial values of the delayline \sa class DelayLine   */  virtual void initDelayLine(int index,                             const typename DEVector<T>::Type &initbuf)                             throw(AUExcept);  /**   * query the trained delays   * @return matrix with delay form neurons+inputs to all outputs   *         size = (output x neurons+inputs)   */  virtual typename DEMatrix<T>::Type getDelays() throw(AUExcept);  /**   * @param output delayline to this output (starting from 0)   * @param nr which neuron or input (starting from 0)   * @return the buffer of the delayline   */  virtual typename DEVector<T>::Type &getDelayBuffer(int output, int nr)    throw(AUExcept);  /// implementation of the algorithm  /// \sa class SimBase::simulate  virtual void simulate(const typename ESN<T>::DEMatrix &in,                        typename ESN<T>::DEMatrix &out); protected:  /// vector with delaylines for each neuron+input to output connection  std::vector< DelayLine<T> > dellines_;  /// temporary object needed for algorithm calculation  typename ESN<T>::DEMatrix intmp_;};/*! * \class SimSquare * * \brief algorithm with additional squared state updates * * Same as SimFilter but with additional squared state updates, which * has the sense to get more nonlinearities in the reservoir without * a need of a very big reservoir size. * Describtion in following paper: * \sa http://www.faculty.iu-bremen.de/hjaeger/pubs/esn_NIPS02.pdf * \note This algorithm uses also filtered neurons as in SimFilter * \sa SimFilterDS * * \example "narma10.py" * \example "sparse_nonlin_system_identification.py" */template <typename T>class SimSquare : public SimFilterDS<T>{  using SimBase<T>::esn_;  using SimBase<T>::last_out_;  using SimBase<T>::t_;  using SimFilter<T>::filter_;  using SimFilterDS<T>::dellines_;  using SimFilterDS<T>::intmp_; public:  SimSquare(ESN<T> *esn) : SimFilterDS<T>(esn) {}  virtual ~SimSquare() {}  /// virtual constructor idiom  virtual SimSquare<T> *clone(ESN<T> *esn) const  {    SimSquare<T> *new_obj = new SimSquare<T>(esn);    new_obj->t_ = t_; new_obj->last_out_ = last_out_;    new_obj->filter_ = filter_; new_obj->dellines_ = dellines_;    new_obj->intmp_ = intmp_; new_obj->t2_ = t2_;    new_obj->insq_ = insq_;    return new_obj;  }  /// reallocates data buffers  virtual void reallocate();  /// implementation of the algorithm  /// \sa class SimBase::simulate  virtual void simulate(const typename ESN<T>::DEMatrix &in,                        typename ESN<T>::DEMatrix &out); protected:  /// temporary object needed for algorithm calculation  typename ESN<T>::DEVector t2_;  typename ESN<T>::DEVector insq_;};} // end of namespace aureservoir#endif // AURESERVOIR_SIMULATE_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -