1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
30 //std::vector<std::string> _Fields;
36 struct greater
: public std::binary_function
<std::pair
<double,int> , std::pair
<double,int> , bool> {
37 bool operator()(std::pair
<double,int> x
, std::pair
<double,int> y
) const
39 return x
.first
> y
.first
;
49 bool getOutput(CRecord
*);
51 int getNbRecords(std::vector
<CRecord
*> &,int,IValue
*);
53 std::vector
<CRecord
*> getRecords(std::vector
<CRecord
*> &, int , bool);
55 void splitRecords(std::vector
<CRecord
*> &, int, int &, int &);
56 void splitRecords(std::vector
<CRecord
*> &, int, std::vector
<CField
*> &, std::vector
< std::vector
<CRecord
*> > &);
58 void splitRecords(std::vector
<CRecord
*> &, int, IValue
*, int &, int &);
59 void splitRecords(std::vector
<CRecord
*> &, int, IValue
*, bool, int &, int &);
61 float findNumKeyValue(std::vector
<CRecord
*> &, int);
63 double log2(double) const;
65 double entropy(double, double) const;
66 double entropy(std::vector
<double> &) const;
67 double gain(std::vector
<CRecord
*> &, int, CField
*);
69 std::vector
<std::pair
<double,int> > getSortedFields(std::vector
<int> &, std::vector
<CRecord
*> &, std::vector
<CField
*> &);
70 int getBestAttrib( std::vector
<int> &, std::vector
<CRecord
*> &, std::vector
<CField
*> &);
71 void rebuild(std::vector
<CRecord
*> &, std::vector
<CField
*> &);
73 std::string
getDebugString(std::vector
<CRecord
*> &, std::vector
<CField
*> &);
75 // returns the root node of a decision tree built with the ID3 algorithm
76 INode
*ID3(std::vector
<int> &, std::vector
<CRecord
*> &, std::vector
<CField
*> &);