45 NearestNeighborClassifier::NearestNeighborClassifier() {}
47 NearestNeighborClassifier::~NearestNeighborClassifier() {}
49 void NearestNeighborClassifier::save(
const std::string filename) {}
51 bool NearestNeighborClassifier::load(
const std::string filename)
56 void NearestNeighborClassifier::addTrainingPoint(
57 std::string target_class,
const std::vector<double>
point)
59 class_data[target_class].push_back(point);
62 void NearestNeighborClassifier::train() {}
64 void NearestNeighborClassifier::clear()
69 std::string NearestNeighborClassifier::classifyPoint(
const std::vector<double>
point)
71 size_t dims = point.size();
76 for (ClassMap::iterator iter = class_data.begin(); iter != class_data.end(); iter++) {
77 std::string cname = iter->first;
80 for (
size_t i = 0; i < cpl.size(); i++) {
82 for (
size_t j = 0; j < dims; j++) {
83 diff += std::fabs(cpl[i][j] - point[j]);
90 }
else if (diff < min_diff) {
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
std::vector< CPoint > CPointList