gnaivebayes.h
来自「一个由Mike Gashler完成的机器学习方面的includes neural」· C头文件 代码 · 共 68 行
H
68 行
/*
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 __GNAIVEBAYES_H__#define __GNAIVEBAYES_H__#include "GLearner.h"class GXMLTag;class GPointerArray;struct GNaiveBayesOutputAttr;// A naive Bayes classifierclass GNaiveBayes : public GSupervisedLearner{protected: int m_nSampleCount; int m_nOutputs; GNaiveBayesOutputAttr** m_pOutputs; int m_nEquivalentSampleSize; double* m_pDiscretizeMins; double* m_pDiscretizeRanges; int m_nDiscretizeBuckets;public: GNaiveBayes(GArffRelation* pRelation); GNaiveBayes(GXMLTag* pTag); virtual ~GNaiveBayes(); // Discard any training (but not any settings) so it can be trained again virtual void Reset(); // Adds a single training sample to the collection void AddTrainingSample(double* pRow); // Train using all the samples in a collection virtual void Train(GArffData* pData); // Evaluates and returns the confidence/probability that it is correct double EvalWithConfidence(double* pRow); // Deduce the output values from the input values
virtual void Eval(double* pVector); // Serialize the internal representation GXMLTag* ToXml(GPointerArray* pAttrNames); void SetEquivalentSampleSize(int n) { m_nEquivalentSampleSize = n; } void ComputeDiscretizeRanges(GArffData* pData); void SetDiscretizeBuckets(int n) { m_nDiscretizeBuckets = n; }protected: void DiscretizeRow(double* pRow); void UndiscretizeRow(double* pRow);};#endif // __GNAIVEBAYES_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?