?? covernn.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://數據區(qū)
////////////////////////////////////////////////////////////
// 學習樣本數據的格式:
// 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://函數區(qū)
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 ×);
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 + -