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

📄 covernn.h

📁 thank you for using this software,which is fugai method,when you can t catch it,please ask me for my
💻 H
字号:
// CoverNN.h: interface for the CoverNN class.
//
//////////////////////////////////////////////////////////////////////
#include <stdlib.h>

struct CovCell
{
	double threshold;//覆盖的半径(阈值)
	double * center;//覆盖中心(权值)
	int kind;//覆盖对应的类别
	CovCell * next;//指向下一个覆盖

	CovCell():threshold(0),center(NULL),kind(-1),next(NULL){}
};

class CoverNN  
{
public:

public://数据区
////////////////////////////////////////////////////////////
//  学习样本数据的格式:
//  LINE1:训练样本总数  样本输入维数
//  LINEi:样本值  类别
////////////////////////////////////////////////////////////
	int Num;//用于学习或者识别的样本总数
	int Dim_in;//样本的输入维数
	double ** Data;//用于学习或识别的样本数据
	int * Target;//学习或识别的目标值
	bool * NoCov;//样本是否已被覆盖标记

	int Num_C;//最后得到的覆盖个数
	CovCell * Covers;//覆盖链表

	double R;//投影的球面半径
	bool InnPro;//标志采用内积计算(true),或者采用欧氏距离(false)

public://函数区
	double Test(int n, int num_each, double disturb, unsigned int seed);
	int ProductTrainData(int n);
	int ProductTestData(int n, int num_each, double disturb, unsigned int seed);
	CoverNN();
	virtual ~CoverNN();

	int LoadNNData();
	int ExportNNData();
	int LoadData(const char * fn_dat, const bool train);
	void Train();
	double Recognize();//返回识别率

private:
	int GetMidpoint(double * midpt, const bool * sfx);
	int GetCovCell(CovCell &cell);
	inline double GetModule(double *vec, int dim);
	int GetProjection(double *pt, const double *a, const int *set, const int k, double **Ei, int &times);
	int GetSet_minDist(const CovCell &cen, int* P_B);
	int GetTranslationpoint( CovCell &cen);
	bool IsRealSubset(const bool * subset, const bool * superset);
	inline double GetInnerProduct(const double* a, const double* b, const int dim);
	inline double GetDistance(const double* a, const double* b, const int dim);
	double Nearest_non(const CovCell &cen);
	double Farthest_kin(const CovCell &cen, const double max);
	int GetDomain(const CovCell &cell, double * cen, bool * sfx);
	bool IsCovered( const CovCell &cell, double * dat);
	bool IsFinished(int &kind);

};

⌨️ 快捷键说明

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