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

📄 basicneuron.h

📁 amygdata的神经网络算法源代码
💻 H
字号:
/***************************************************************************                          basicneuron.h  -  description                             -------------------    copyright            : (C) 2000, 2001, 2002, 2003 by Matt Grover    email                : mgrover@amygdala.org ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef BASICNEURON_H#define BASICNEURON_H#include <amygdala/spikingneuron.h>#include <amygdala/spikingneuronproperties.h>#include <amygdala/factory.h>#include <amygdala/functionlookup.h>namespace Amygdala {/** @class BasicNeuronProperties basicneuron.h amygdala/basicneuron.h  * @author Matt Grover  */class BasicNeuronProperties: public SpikingNeuronProperties {public:    BasicNeuronProperties();    BasicNeuronProperties(bool initializePhysicalProps);    BasicNeuronProperties(const BasicNeuronProperties& rhs);    virtual ~BasicNeuronProperties();    /** @return Synaptic time constant (ms) */    float GetSynapseConst() const { return synTimeConst; }    void SetSynapseConst(float timeConst) { synTimeConst = timeConst; }    virtual BasicNeuronProperties* Copy() const;    virtual std::map< std::string, std::string > GetPropertyMap() const;protected:    float synTimeConst;				// synaptic time constant (ms)};/** @class BasicNeuron basicneuron.h amygdala/basicneuron.h  * @brief BasicNeuron implements a simple integrate-and-fire  * neuron model based on the model presented in chapter 1  * of Pulsed Neural Networks, but with the membrane time constant  * set to 0.  *  * The BasicNeuron PSP is modeled as  * \f[ U = \left( \frac{t}{\tau_s^2} \right) * exp\left( \frac{-t}{\tau_s} \right) \f]  * @see Neuron, AlphaNeuron, FastNeuron  * @author Matt Grover  */class BasicNeuron : public SpikingNeuron  {public:    typedef NeuronFactory<BasicNeuron,BasicNeuronProperties> Factory;    virtual ~BasicNeuron();    /** @return Current membrane potential */    virtual float GetMembranePtnl();protected:    // Functions:    BasicNeuron(AmIdInt neuronId,                const BasicNeuronProperties& neuronProps);    virtual void SetProperties(NeuronProperties* props) {SetProperties(dynamic_cast<BasicNeuronProperties*>(props)); }    void SetProperties(BasicNeuronProperties* props);    /** Send a spike to this Neuron.     * @param inTime Time of input (microseconds).     * @see Neuron::SendSpike(), Network::SendDelayedSpikes(). */    virtual void ProcessInput(const AmTimeInt& inTime);    /** Do any tasks that need to be done after the neuron spikes */    virtual void SpikeCleanup();        /** Normalize the PSP lookup tables */    void ScaleFunctionLookups();	/** Initialize the lookup tables */    void InitLookup();    /** Build the lookup tables.  This is only done once     * for each unique set of BasicNeuronProperties */	void MakeLookupTables();	TableProperties GetTableProps(unsigned int index);	    struct InputHist {	    AmTimeInt time;	    float weight;    };    std::vector<InputHist> inputHist;    unsigned int histBeginIdx;        // Needed for calculation of spike times    float maxThreshCrs;    float convergeRes;private:    /** Calculate the value of the PSP function and derivative     * for a given time. calcTime is relative to the arrival     * of a spike and is in microseconds.     * @param calcTime Time from the last input to this neuron.     * @param pspElement Pointer to the calculated value. */    void PspKernel(float calcTime, float* pspElement);    /** Find the derivative of PspKernel     * @param calcTime Time from the last input to this neuron.     * @param dPspElement Pointer to the calculated value. */    void DPspKernel(float calcTime, float* dPspElement);    /** Calculate the current membrane potential of the neuron     * based on the history of inputs since the last output     * spike. Called from InputSpike.     * @param state Current state of the neuron (return value).     * @param deriv Derivative of current state (return value).     * @param calceTime Time used for the calculation.     * @param historySize historySize Number of history elements to     * include in the calculatiom. */    inline void CalcState(float& state, float& deriv,                          const AmTimeInt& calcTime,                          const AmTimeInt& historySize);                              /*     * Tables used to cache value of PSP function and its derivative     * for each time step (number of steps cached is specified by     * pspLSize)     */    float* pspLookup;    float* dPspLookup;    static unsigned int pspStepSize;	static unsigned int pspLSize;	static void Init();	    template<class neuron, class neuronProperties>    friend class NeuronFactory;};namespace Factory {    static BasicNeuron::Factory MakeBasicNeuron;}} // namespace Amygdala#endif

⌨️ 快捷键说明

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