📄 predacc.h
字号:
// ********************************************************
// This is demo code. You may derive from, use, modify, and
// distribute it without limitation for any purpose.
// Obviously you don't get a warranty or an assurance of
// fitness for a particular purpose with this code. Your
// welcome to remove this header and claim original
// authorship. I really don't care.
// ********************************************************
#ifndef __PREDACC_H__
#define __PREDACC_H__
#include "Gui.h"
class GArffRelation;
class GArffData;
class GSupervisedLearner;
class GPointerArray;
class PredAccController;
class PredAccDialog : public GWidgetDialog
{
protected:
PredAccController* m_pController;
GWidgetListBox* m_pAlgorithmList;
GWidgetListBox* m_pTestTechniqueList;
GWidgetTextLabel* m_pTextBoxLabel;
GWidgetTextBox* m_pTextBox;
GPointerArray* m_pFiles;
GWidgetTextLabel* m_pTitle;
GArffRelation* m_pRelation;
GPointerArray* m_pTrainingRows;
GPointerArray* m_pTestRows;
GWidgetGrid* m_pTrainingData;
GWidgetGrid* m_pTestData;
GWidgetTextButton* m_pShuffleButton1;
GWidgetTextButton* m_pShuffleButton2;
GWidgetFileSystemBrowser* m_pFileSystemBrowser1;
GWidgetFileSystemBrowser* m_pFileSystemBrowser2;
GWidgetTextButton* m_pBeginButton;
int m_nTestTechnique;
double m_dTrainingPercent;
public:
PredAccDialog(PredAccController* pController, int w, int h);
virtual ~PredAccDialog();
void SetTrainingSet(GArffRelation* pRelation, GArffData* pTrainingSet);
void SetTestSet(GArffRelation* pRelation, GArffData* pTestSet);
virtual void OnSelectFilename(GWidgetFileSystemBrowser* pBrowser, const char* szFilename);
virtual void OnChangeListSelection(GWidgetListBox* pListBox);
virtual void OnReleaseTextButton(GWidgetTextButton* pButton);
};
class PredAccView : public ViewBase
{
protected:
PredAccDialog* m_pDialog;
public:
PredAccView(PredAccController* pController);
virtual ~PredAccView();
virtual void OnChar(char c);
virtual void OnMouseDown(int x, int y);
virtual void OnMouseUp(int x, int y);
virtual bool OnMousePos(int x, int y);
void SetTrainingSet(GArffRelation* pRelation, GArffData* pTrainingSet);
void SetTestSet(GArffRelation* pRelation, GArffData* pTestSet);
protected:
virtual void Draw(SDL_Surface *pScreen);
};
class PredAccController : public ControllerBase
{
protected:
PredAccView* m_pPredAccView;
GArffRelation* m_pRelation;
GArffData* m_pTrainingSet;
GArffData* m_pTestSet;
GSupervisedLearner* m_pLearner;
public:
PredAccController();
virtual ~PredAccController();
void RunModal();
void HandleKeyPress(SDLKey eKey, SDLMod mod);
void HandleMouseClick();
void LoadTrainingSet(const char* szFilename);
void LoadTestSet(const char* szFilename);
void LoadAndSplitTrainingSet(const char* szFilename, double dTestPercent);
void ShuffleTrainingSet();
void ShuffleTestSet();
void TrainAndTestSingleSet(int nAlgorithm);
void TrainAndTest(int nAlgorithm);
void DoNFoldCrossValidation(int nAlgorithm, int nParts);
void Train(int nAlgorithm, GArffRelation* pRelation, GArffData* pTrainingSet);
void Test(int nAlgorithm, GArffData* pTestSet);
protected:
GSupervisedLearner* MakeLearner(int nAlgorithm, GArffRelation* pRelation);
};
#endif // __PREDACC_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -