📄 lvq.h
字号:
#ifndef LVQ_H
#define LVQ_H
#include <pcadll.h>
typedef struct SAMMON_PICT_TAG
{
CMatrix *pmat;
char name[30];
long lnum, total;
float error;
} SAMMON_PICT, *PSAMMON_PICT;
class CSammon : public CObject
{
public:
double length; /*if > 1 running length, else mapping error bound*/
int times; /*number of times sammon has to be done during the learning*/
int xdim, ydim;
private:
CObArray data;
public:
CSammon();
~CSammon();
int AddPict(PSAMMON_PICT pict);
PSAMMON_PICT GetPict(int);
int GetSize();
};
class CViewSammon : public CFrameWnd
{
public:
CViewSammon(CSammon *psam);
CViewSammon();
~CViewSammon();
void Play();
CSammon *pSammon;
BOOL PreCreateWindow(CREATESTRUCT& cs);
private:
float xmax, xmin, ymax, ymin;
int n_pict;
CStringList *pClass;
// Generated message map functions
protected:
//{{AFX_MSG(CWndFace)
afx_msg void OnPaint();
afx_msg void OnTimer(UINT);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/* topology types */
#define TOPOL_UNKNOWN 0
#define TOPOL_DATA 1
#define TOPOL_LVQ 2
#define TOPOL_HEXA 3
#define TOPOL_RECT 4
/* neighborhood types */
#define NEIGH_UNKNOWN 0
#define NEIGH_BUBBLE 1
#define NEIGH_GAUSSIAN 2
/* alpha function types */
#define ALPHA_UNKNOWN 0
#define ALPHA_LINEAR 1
#define ALPHA_INVERSE_T 2
/* Structure used to pass the data to and from LVQ */
typedef struct LVQPARAMS_TAG
{
short noc; /*total number of codebook vectors*/
short knn; /*number of nearest neighbours used in knn classification*/
short xdim, ydim; /*dimention of the SOM*/
short neigh; /*type of the neighborhood (can be
NEIGH_UNKNOWN, NEIGH_BUBBLE or NEIGH_GAUSSIAN)*/
short topol; /*type of the topology of the SOM (can be
TOPOL_UNKNOWN, TOPOL_DATA, TOPOL_LVQ, TOPOL_HEXA, TOPOL_RECT)*/
int randomize; /*Seed of the random number generator (if equals 0, use clock as seed)*/
short alpha_type; /*type of alpha decrease, can be ALPHA_LINEAR, or ALPHA_INVERSE_T*/
float radius; /*initial radius for som, between 0 to 360*/
float alpha; /*initial alpha value*/
long length; /*length of training*/
float winlen; /*length of the window used with lvq2 and lvq3*/
float epsilon; /*relative learning rate parameter used only in lvq3*/
CMatrix *pdata; /*training vectors*/
CMatrix *pcode; /*codebook vectors*/
CMatrixSym *pconfusion; /*the accuracy fct put the confusion matrix into it*/
CSammon *sammon; /*sammon data*/
} LVQPARAMS, *PLVQPARAMS;
/* Exported functions */
int eveninit(PLVQPARAMS params);
int propinit(PLVQPARAMS params);
int balance(PLVQPARAMS params);
int lvq1(PLVQPARAMS params);
int olvq1(PLVQPARAMS params);
int lvq2(PLVQPARAMS params);
int lvq3(PLVQPARAMS params);
int accuracy(PLVQPARAMS params);
int classify(PLVQPARAMS params);
int LVQInit(PLVQPARAMS params);
int LVQEnd(PLVQPARAMS params);
char *GetClassStr(int i);
#endif /*LVQ_H*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -