faif
|
machine learning namespace (mainly classifier algorithms) More...
Classes | |
struct | AddEvidenceFunctor |
class | Belief |
belief is value id with probability More... | |
struct | BeliefConcept |
the belief concept More... | |
class | Classifier |
the clasiffier interface More... | |
class | DecisionTree |
Decision Tree Classifier. More... | |
struct | DecisionTreeTrainParams |
param for training decision tree More... | |
class | DistanceNominalValue |
Distance metrics for Nomianal Values Collection, used in K Nearest Neighbors classifier. More... | |
struct | FusionInternal |
typedef's for Dempster-Shafer combination rule (for fusion) and some internal (helping) methods More... | |
class | KNearestNeighbor |
k Nearest Neighbor classifier More... | |
class | NaiveBayesian |
Naive Bayesian Classifier. More... | |
struct | NormalizationFunctor |
struct | PrintCountAttrFunctor |
class to show the classifier state, print the attribs and counters More... | |
struct | PrintCountersFunctor |
print the cauters for given category More... | |
class | RandomForest |
Random Forest Classifier. More... | |
struct | RandomForestParams |
random forest's parameters More... | |
class | SvmClassifier |
class | TrainExampleCategoryCounters |
Functions | |
template<typename Val > | |
std::ostream & | operator<< (std::ostream &os, const Belief< Val > &b) |
template<typename Val > | |
std::ostream & | operator<< (std::ostream &os, const std::vector< Belief< Val > > &c) |
double | calcEntropy (double freq) |
calculate x * log(x) value. If x == 0 return 0. More... | |
template<typename Val > | |
std::ostream & | operator<< (std::ostream &os, const Classifier< Val > &c) |
template<typename It , typename Val > | |
Classifier< Val >::ExampleTest | createExample (It begin, It end, const Classifier< Val > &classifier) |
create the test example from iterator range or C-like table of values More... | |
template<typename It , typename Val > | |
Classifier< Val >::ExampleTrain | createExample (It begin, It end, const typename Classifier< Val >::AttrValue &cat, const Classifier< Val > &classifier) |
create the train example from range or C-like table of values More... | |
template<typename Val > | |
Classifier< Val >::ExampleTest | createExample (const std::vector< std::pair< std::string, typename Classifier< Val >::AttrValue > > &collection, const Classifier< Val > &classifier) |
create the test example from collection of pairs: attribute(domain) identifier and attribute value More... | |
template<typename Val > | |
Classifier< Val >::ExampleTest | createExampleStrict (const std::vector< std::pair< std::string, typename Classifier< Val >::AttrValue > > &collection, const Classifier< Val > &classifier) |
create the test example from collection of pairs: attribute(domain) identifier and attribute value. Throws exception if the string identifiers not match the required domains identifiers More... | |
template<typename Val > | |
Classifier< Val >::ExampleTrain | createExample (const std::vector< std::pair< std::string, typename Classifier< Val >::AttrValue > > &collection, const typename Classifier< Val >::AttrValue &cat, const Classifier< Val > &classifier) |
create the train example from collection of pairs: attribute(domain) identifier and attribute value More... | |
template<typename Belief > | |
Belief::Beliefs | fusion (const typename std::vector< typename Belief::Beliefs > &input) |
connect categories using the Dempster-Shafer combination rule, e.g. bel(cat) = bel1(cat) * bel2(cat) * ... * beln(cat) / SUM(bel) More... | |
template<typename Val > | |
int | checkClassifier (const typename Classifier< Val >::ExamplesTrain &test, Classifier< Val > &classifier) |
check the classifier More... | |
template<typename Val > | |
int | testRange (std::vector< const typename Classifier< Val >::ExampleTrain * > &tcollect, int start_idx, int end_idx, Classifier< Val > &classifier) |
template<typename Val > | |
double | checkCross (const typename Classifier< Val >::ExamplesTrain &examples, int k, Classifier< Val > &classifier) |
machine learning namespace (mainly classifier algorithms)
std::ostream& faif::ml::operator<< | ( | std::ostream & | os, |
const std::vector< Belief< Val > > & | c | ||
) |
stream operator - for debugging
|
inline |
calculate x * log(x) value. If x == 0 return 0.
Referenced by faif::ml::TrainExampleCategoryCounters< Val >::entropy(), and faif::ml::DecisionTree< Val >::prune().
std::ostream& faif::ml::operator<< | ( | std::ostream & | os, |
const Classifier< Val > & | c | ||
) |
ostream operator
Classifier<Val>::ExampleTest faif::ml::createExample | ( | It | begin, |
It | end, | ||
const Classifier< Val > & | classifier | ||
) |
create the test example from iterator range or C-like table of values
References faif::ml::Classifier< Val >::getAttrDomains().
Classifier<Val>::ExampleTrain faif::ml::createExample | ( | It | begin, |
It | end, | ||
const typename Classifier< Val >::AttrValue & | cat, | ||
const Classifier< Val > & | classifier | ||
) |
create the train example from range or C-like table of values
References faif::ml::Classifier< Val >::getAttrDomains(), and faif::ml::Classifier< Val >::getCategoryDomain().
Classifier<Val>::ExampleTest faif::ml::createExample | ( | const std::vector< std::pair< std::string, typename Classifier< Val >::AttrValue > > & | collection, |
const Classifier< Val > & | classifier | ||
) |
create the test example from collection of pairs: attribute(domain) identifier and attribute value
References faif::ml::Classifier< Val >::getAttrDomains().
Classifier<Val>::ExampleTest faif::ml::createExampleStrict | ( | const std::vector< std::pair< std::string, typename Classifier< Val >::AttrValue > > & | collection, |
const Classifier< Val > & | classifier | ||
) |
create the test example from collection of pairs: attribute(domain) identifier and attribute value. Throws exception if the string identifiers not match the required domains identifiers
References faif::ml::Classifier< Val >::getAttrDomains().
Classifier<Val>::ExampleTrain faif::ml::createExample | ( | const std::vector< std::pair< std::string, typename Classifier< Val >::AttrValue > > & | collection, |
const typename Classifier< Val >::AttrValue & | cat, | ||
const Classifier< Val > & | classifier | ||
) |
create the train example from collection of pairs: attribute(domain) identifier and attribute value
References faif::ml::Classifier< Val >::getAttrDomains(), and faif::ml::Classifier< Val >::getCategoryDomain().
Belief::Beliefs faif::ml::fusion | ( | const typename std::vector< typename Belief::Beliefs > & | input | ) |
connect categories using the Dempster-Shafer combination rule, e.g. bel(cat) = bel1(cat) * bel2(cat) * ... * beln(cat) / SUM(bel)
int faif::ml::checkClassifier | ( | const typename Classifier< Val >::ExamplesTrain & | test, |
Classifier< Val > & | classifier | ||
) |
check the classifier
test | examples |
classifier |
Referenced by testRange().
int faif::ml::testRange | ( | std::vector< const typename Classifier< Val >::ExampleTrain * > & | tcollect, |
int | start_idx, | ||
int | end_idx, | ||
Classifier< Val > & | classifier | ||
) |
f. pomocnicza, zwraca liczbe prawidlowo zaklasyfikowanych przykladow z tcollect. Przyklady testujace to <start_idx, end_idx). Reszta - to przyklady trenujace.
References checkClassifier(), faif::ml::Classifier< Val >::reset(), and faif::ml::Classifier< Val >::train().
double faif::ml::checkCross | ( | const typename Classifier< Val >::ExamplesTrain & | examples, |
int | k, | ||
Classifier< Val > & | classifier | ||
) |
check the classifier, return the probability of proper classification result. The example set is divided on k sections (randomly), one section is the testing set, the rest k-1 sections are the training set. This test is repeated k times.
examples | training examples (the part is randomly choosen as testing) |
k | num sections for cross-validation |
classifier | classifier |