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

📄 ne-data.h

📁 neural network 一个演示原理的代码
💻 H
字号:
#if!defined( __NEDATA_H__ )
#define __NEDATA_H__

#include <time.h>
#include <math.h>

namespace aine
{
	/*!
		\author Hannosset Christophe
		\author c.hannosset@ainenn.org
		\version 1.0
		\date	26 - 07 - 2004

		\brief 
		\todo 
		\bug
		\warning 
	*/

	class IOData	{
	public:
		vector<double>	input , output;	//!< data input with the associated output.
		IOData( void )	{}
		IOData( const int nrIn , const int nrOut , ... );
		IOData( const int nrin , const int nrout , istream &in );
	};

	class IOListData : public vector<IOData>	{
	public:
		IOListData( void )	{};
		IOListData( const string filename );
		IOListData( vector<IOData> &dta , const int nr = -1 )
		{
			resize( nr < 1 ? dta.size() : nr );
			if( nr != -1 )
				copy( dta.begin() , dta.begin() + nr , begin() );
			else
				copy( dta.begin() , dta.end() , begin() );
		}
	};

	/*!	Generate a random number between two ranges
	 *	Sets up the seed if not yet initialized.
	 *	\param lower_bound lower bound of the range
	 *	\param upper_bound upper bound of the range
	 *	\param aflag if set to false, reinitialize the seed at the next call.
	*/
	static double Random( const double lower_bound , const double upper_bound , const bool aflag = true )
	{
		static bool flag = false;
		if( !flag )
			srand( (int)time( 0 ) );
		flag = aflag;

		return (((double)((rand()%RAND_MAX))/(double)RAND_MAX)*(upper_bound-lower_bound)+lower_bound);
	}
}

#endif

⌨️ 快捷键说明

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