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

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

Mostly related to #295 and #182

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 569 bytes
Line 
1// $Id: KNN_Uniform.cc 1112 2008-02-21 14:59:30Z 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 <vector>
10
11namespace theplu {
12namespace yat {
13namespace classifier {
14
15  void KNN_Uniform::operator()(const utility::VectorBase& distance,
16                               const std::vector<size_t> k_sorted, 
17                               const Target& target, 
18                               utility::VectorMutable& prediction) const
19  {           
20    std::vector<size_t>::size_type k=k_sorted.size();
21    for(size_t j=0;j<k;j++) 
22      prediction(target(k_sorted[j]))+=1.0;           
23  }
24
25}}}
Note: See TracBrowser for help on using the repository browser.