11#include <boost/array.hpp>
24 class Histogram :
public boost::array<std::uint32_t,NUMLABELS> {
26 inline Histogram() { std::fill(begin(), end(), 0); }
137 if(
Ntotal == 0 )
return 0.;
187 os<<
sp.attribId<<
" "<<
sp.threshold<<
"\n";
192 is >>
sp.attribId >>
sp.threshold;
205 if( !
fout.is_open() )
throw std::runtime_error(std::string(
"(E) could not open ") +
filename );
207 fout<<
int(attribId)<<
" "<<
int(threshold)<<
"\n";
218 if( !
fin.is_open() )
throw std::runtime_error(std::string(
"(E) could not open") +
filename );
221 if(
fin.fail() )
throw std::runtime_error(std::string(
"(E) malformed splitInfo file ") +
filename );
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
void writeInfoFile(const std::string &filename, int attribId, Attrib threshold, double gain, const HistogramPair &HP)
static double entropy(const Histogram &h)
This is cool.
static std::uint64_t numElements(const Histogram &h)
static double informationGain(const HistogramPair &hp)
This will compute the gain in information resulting from the split.
static void writeLabeledFeatureVec(std::ostream &os, const std::vector< LabeledFeature > &lfs)
std::istream & operator>>(std::istream &is, AttribLocation &aloc)
void readInfoFile(const std::string &filename, int &attribId, Attrib &threshold, double &gain, HistogramPair &HP)
std::ostream & operator<<(std::ostream &os, const AttribLocation &aloc)
static double entropy_merged(const HistogramPair &hp)
This is a little weird.
void accumTrue(const Label label)
void accumFalse(const Label label)
const Histogram h_false() const
const Histogram h_true() const
LabeledAttrib(const Label &label, const Attrib &attrib)
Attrib attribs[NUMATTRIBS]
LabeledFeature(const LabeledFeature &B)
SplitPoint(int ai, Attrib t)