gpctree.h
来自「一个由Mike Gashler完成的机器学习方面的includes neural」· C头文件 代码 · 共 87 行
H
87 行
/* 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 __GPCTREE_H__#define __GPCTREE_H__#include "GLearner.h"class GPCTreeNode;// A PCTree is similar a DecisionTree, except it divides as follows:// It finds the mean and principle component of the output vectors.// It divides all the vectors into two groups, one that has a// positive dot-product with the principle component (after subtracting// the mean) and one that has a negative dot-product with the// principle component (after subtracting the mean). Next it finds the// average input vector for each of the two groups. Then it finds// the mean and principle component of those two vectors. The dividing// criteria for this node is to subtract the mean and then see whether// the dot-product with the principle component is positive or negativeclass GPCTree : public GSupervisedLearner{protected: GPCTreeNode* m_pRoot; int m_nInputVectorSize; int m_nOutputVectorSize; double* m_pEvalVector;public: GPCTree(GArffRelation* pRelation); virtual ~GPCTree(); // Discard any training (but not any settings) so it can be trained again virtual void Reset(); // Inductively build the tree
virtual void Train(GArffData* pData);
// Deduce the output values from the input values
virtual void Eval(double* pVector);protected: GPCTreeNode* BuildNode(GArffData* pData, double* pBuf);};// This is like a PC-tree, but the division hyper-surface is// selected randomlyclass GArbitraryTree : public GSupervisedLearner{protected: GPCTreeNode* m_pRoot; int m_nInputVectorSize; int m_nOutputVectorSize; double* m_pEvalVector; bool m_bAxisAligned;public: GArbitraryTree(GArffRelation* pRelation, bool bAxisAligned); virtual ~GArbitraryTree(); // Discard any training (but not any settings) so it can be trained again virtual void Reset();
// Inductively build the tree virtual void Train(GArffData* pData);
// Deduce the output values from the input values
virtual void Eval(double* pVector);protected: GPCTreeNode* BuildNode(GArffData* pData);};#endif // __GPCTREE_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?