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

📄 statisticsoutput.h

📁 amygdata的神经网络算法源代码
💻 H
字号:
/***************************************************************************                          statisticsoutput.h  -  description                             -------------------    begin                : Wed Oct 24 2001    copyright            : (C) 2001 by Matt Grover    email                : mpgrover@sourceforge.net ***************************************************************************//*************************************************************************** *                                                                         * *   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 STATISTICSOUTPUT_H#define STATISTICSOUTPUT_H//#include "config.h"#include <map>#include <vector>#include <set>#include <string>#include <amygdala/spikeoutput.h>#include <amygdala/outputmanager.h>#include <amygdala/factory.h>#include <stdio.h>namespace Amygdala {/**@class StatisticsOutput statisticsoutput.h amygdala/statisticsoutput.h  * Provides statistics and logging facilities to debug networks.  *@see SpikeOutput  *@author Matt Grover  *@author R黡iger Koch  */class StatisticsOutput : public SpikeOutput  {	friend class OutputManager;public:     typedef SpikeOutputFactory<StatisticsOutput> Factory;	StatisticsOutput();	virtual ~StatisticsOutput();		/**	 * Raise an output event.  If output is turned on in streaming mode,	 * this function will be called every time an output neuron spikes.	 */	virtual void OutputEvent(Neuron* nrn, AmTimeInt eventTime);		/**	 * If output is turned on in caching mode,	 * this function will be called every time the cache is emptied.	 * Arguments TBD.	 */	virtual void OutputCache() {};		/**	 * Set the time step size (ms) to be used for calculating	 * spike rates.  This also determines the width of the	 * elements for the histograms.	 */	void SetStepSize(AmTimeInt step);	    /**     * Get the time step size. (ms)     */		AmTimeInt GetStepSize() const { return stepSize; }		/**	 * Clear out the raw data.  This may be done if the simulation	 * is run for a period of time and then resumed after doing	 * some analysis of the results.  ClearHistory() can be called	 * before resuming if the old data is not wanted for the next	 * round of analysis.	 */	void ClearHistory();		/**	 * Generate a histogram detailing the combined output	 * activity for all output neurons during the life of	 * the simulation.	 */	std::vector<unsigned int>& Histogram();		/**	 * Generate a histogram detailing the activity of neuronId	 * during the life of the simulation.	 */	std::vector<unsigned int>& Histogram(AmIdInt neuronId);		/**	 * Generate a histogram detailing the combined output	 * activity for all output neurons between start and	 * end times.  Times are measured in ms.	 */	std::vector<unsigned int> Histogram(AmTimeInt start, AmTimeInt end);		/**	 * Generate a histogram detailing the activity of neuronId	 * between start and end times. Times are measured in ms.	 */	std::vector<unsigned int> Histogram(AmIdInt neuronId, AmTimeInt start, AmTimeInt end);		/**	 * Find the peak spike rate for the combined output of	 * all output neurons. (spikes/sec)	 */	float PeakSpikeRate();		/**	 * Find the peak spike rate for neuronId. (spikes/sec)	 */	float PeakSpikeRate(AmIdInt neuronId);		/**	 * Find the time of the peak spike rate for the combined output	 * of all output neurons. (ms)	 */	AmTimeInt PeakRateTime();		/**	 * Find the time of the peak spike rate for neuronId. (ms)	 */	AmTimeInt PeakRateTime(AmIdInt neuronId);		/**	 * Find the neuron with the highest peak spike rate.	 */	AmIdInt PeakNeuron();		/**	 * Find the neuron with the highest number of output	 * spikes overall.	 */	AmIdInt MostActiveNeuron();		/**	 * Find the total number of spikes for all	 * output neurons.	 */	unsigned int TotalOutputSpikes();		/**	 * Find the total number of spikes for neuron neuronId.	 */	unsigned int TotalOutputSpikes(AmIdInt neuronId);		/**	 * Find the mean spike rate for all output neurons.	 * (spikes/sec)	 */	float MeanSpikeRate();		/**	 * Find the mean spike rate for neuron neuronId.	 * (spikes/sec)	 */	float MeanSpikeRate(AmIdInt neuronId);  /** Turn on logging   * @param filename The logfile   * @param start simTime when logging starts   * @param end   simTime when logging ends   */    void LogSpikeTimes(string filename, AmTimeInt start=0, AmTimeInt end=~0);  /** Close a the file descriptor if open */  void CloseLog();  void AddTrace(unsigned int groupId);protected:  // protected methods  /** write logging info to the log file */    void Log(Neuron* nrn, AmTimeInt eventTime);	protected:    std::map< AmIdInt, std::vector<AmTimeInt> > outputHistory;  // map<nId, spikeTime>  /** The histograms can be filled either during the simulation inside OutputEvent()    * or later on from the contents of outputHistory. */    std::map< AmIdInt, std::vector<unsigned int> > histogram;    std::vector<unsigned int> combinedHistogram;    AmIdInt maxPeakId;  // The neuron with the highest peak activity    AmTimeInt maxPeakTime;  // Time of peak activity of maxPeakId    AmIdInt mostActiveId;   // The neuron with the highest number of spikes    unsigned int mostActiveCount;   // Number of times mostActiveId spiked    float combinedPeakRate;    AmTimeInt combinedPeakTime;    float meanRate;    unsigned int totalSpikeCount;    unsigned int traceGroups;   // group id bit field/** histogram step size (ms) */    AmTimeInt stepSize;/** Time that statistics collection began (can be reset) */    AmTimeInt beginTime;/** Time of last reported output spike (us) */    AmTimeInt calcTime;/** Time that last calculation was done (us) */    AmTimeInt lastCalcTime;    bool logging;    AmTimeInt logStart;    AmTimeInt logEnd;    FILE *logFd;};namespace Factory {    static StatisticsOutput::Factory MakeStatisticsOutput;}} // namespace Amygdala#endif

⌨️ 快捷键说明

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