|
faif
|
k Nearest Neighbor classifier More...
#include <KNearestNeighbor.hpp>


Public Types | |
| typedef Classifier< Val >::AttrValue | AttrValue |
| typedef Classifier< Val >::AttrDomain | AttrDomain |
| typedef Classifier< Val >::AttrIdd | AttrIdd |
| typedef Classifier< Val >::AttrIddSerialize | AttrIddSerialize |
| typedef Classifier< Val >::Domains | Domains |
| typedef Classifier< Val >::Beliefs | Beliefs |
| typedef Classifier< Val >::ExampleTest | ExampleTest |
| typedef Classifier< Val >::ExampleTrain | ExampleTrain |
| typedef Classifier< Val >::ExamplesTrain | ExamplesTrain |
| typedef Val | Value |
Public Member Functions | |
| KNearestNeighbor (const Domains &attr_domains, const AttrDomain &category_domain) | |
| virtual void | reset () |
| reset - clear the memory More... | |
| virtual void | train (const ExamplesTrain &e) |
| learn classifier (on the collection of training examples), here store all train examples. More... | |
| virtual AttrIdd | getCategory (const ExampleTest &e) const |
| AttrIdd | getCategoryK (const ExampleTest &e, int K) const |
| virtual Beliefs | getCategories (const ExampleTest &e) const |
| classify and return all classes with belief that the example is from given class More... | |
| Beliefs | getCategoriesK (const ExampleTest &e, int K) const |
| classify and return all classes with belief that the example is from given class More... | |
| virtual void | write (std::ostream &os) const |
| int | getDefaultK () const |
| void | setDefaultK (int k) |
| const Domains & | getAttrDomains () const |
| accessor More... | |
| const AttrDomain & | getCategoryDomain () const |
| accessor More... | |
| AttrIdd | getCategoryIdd (const AttrValue &val) const |
| accessor (helper) More... | |
Friends | |
| class | boost::serialization::access |
| serialization using boost::serialization More... | |
k Nearest Neighbor classifier
Contains the attributes, attribute values and categories, train examples, test examples and classifier methods.
|
virtual |
|
virtual |
learn classifier (on the collection of training examples), here store all train examples.
learn classifier (on the collection of training examples) - remember training examples
Implements faif::ml::Classifier< Val >.
|
inlinevirtual |
classify - find the category in neighbors, use default K (number of neighbors)
Implements faif::ml::Classifier< Val >.
| KNearestNeighbor< Val, Distance >::AttrIdd faif::ml::KNearestNeighbor< Val, Distance >::getCategoryK | ( | const ExampleTest & | e, |
| int | K | ||
| ) | const |
classify - find the category in neighbors, use given K (number of neighbors)
classify - return the major category for best node from decision tree
References faif::ml::KNearestNeighbor< Val, Distance >::getCategoriesK().
|
inlinevirtual |
classify and return all classes with belief that the example is from given class
use default K (number of neighbors)
Implements faif::ml::Classifier< Val >.
| KNearestNeighbor< Val, Distance >::Beliefs faif::ml::KNearestNeighbor< Val, Distance >::getCategoriesK | ( | const ExampleTest & | e, |
| int | K | ||
| ) | const |
classify and return all classes with belief that the example is from given class
use given K (number of neighbors)
Referenced by faif::ml::KNearestNeighbor< Val, Distance >::getCategoryK().
|
virtual |
|
inline |
accessor - get the default number of neighbors used in calculation
|
inline |
mutator - set the default number of neighbors used in calculation
|
inlineinherited |
accessor
Referenced by faif::ml::createExample(), faif::ml::createExampleStrict(), and faif::ml::RandomForest< Val >::getCategories().
|
inlineinherited |
accessor
Referenced by faif::ml::createExample().
|
inlineinherited |
|
friend |
serialization using boost::serialization
1.8.11