source: trunk/yat/classifier/KNN_Uniform.cc @ 1274

Last change on this file since 1274 was 1156, checked in by Markus Ringnér, 14 years ago

Refs. #335, fixed for KNN

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 592 bytes
Line 
1// $Id: KNN_Uniform.cc 1156 2008-02-26 08:46:49Z markus $
2
3#include "KNN_Uniform.h"
4#include "Target.h"
5
6#include "yat/utility/VectorBase.h"
7#include "yat/utility/VectorMutable.h"
8
9#include <cmath>
10#include <vector>
11
12namespace theplu {
13namespace yat {
14namespace classifier {
15
16  void KNN_Uniform::operator()(const utility::VectorBase& distance,
17                               const std::vector<size_t> k_sorted, 
18                               const Target& target, 
19                               utility::VectorMutable& prediction) const
20  {           
21    for(size_t j=0;j<k_sorted.size();j++) 
22      if(!std::isinf(distance(k_sorted[j])))
23         prediction(target(k_sorted[j]))+=1.0;           
24  }
25
26}}}
Note: See TracBrowser for help on using the repository browser.