gbag.h
来自「一个由Mike Gashler完成的机器学习方面的includes neural」· C头文件 代码 · 共 78 行
H
78 行
/* Copyright (C) 2006, Mike Gashler This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. see http://www.gnu.org/copyleft/lesser.html*/#ifndef __GBAG_H__#define __GBAG_H__#include "GLearner.h"class GPointerArray;class GArffRelation;// BAG stans for bootstrap aggregator. This class basically holds a bunch// of supervised learning algorithms and combines their results to produce// final results with lower variance.class GBag : public GSupervisedLearner{protected: GPointerArray* m_pLearners; int m_nVectorModeOutputSize; double* m_pVectorModeOutputs; double* m_pAccumulator;public: GBag(GArffRelation* pRelation, int nInitialSize); virtual ~GBag(); // Discard any training (but not any learners that were added) so it can be trained again virtual void Reset(); // Removes and deletes all the learners void Flush(); // Adds a learner to the bag. This takes ownership of pLearner (so // it will delete it when it's done with it) void AddLearner(GSupervisedLearner* pLearner); // Trains all the learning algorithms with the complete data set. Note // that it's common to train each algorithm with a different portion // of the data set. That's not what this method does. todo: write one // that does that. virtual void Train(GArffData* pData); // Evaluates with each of the learning algorithms and // combines the results virtual void Eval(double* pVector);};// When you call Train, GSmartForest performs a meta-test to determine// which algorithm will do the best, then it adds them all to the bag// and trains themclass GSmartForest : public GBag{protected: int m_nSize;public: GSmartForest(GArffRelation* pRelation, int nSize); virtual ~GSmartForest(); virtual void Train(GArffData* pData);protected: void DoMetaLearning(GArffData* pData);};#endif // __GBAG_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?