source: trunk/yat/classifier/KNN_ReciprocalDistance.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: 584 bytes
Line 
1// $Id: KNN_ReciprocalDistance.cc 1112 2008-02-21 14:59:30Z markus $
2
3#include "KNN_ReciprocalDistance.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_ReciprocalDistance::operator()(const utility::VectorBase& distance,
16                                          const std::vector<size_t> k_sorted, 
17                                          const Target& target, 
18                                          utility::VectorMutable& prediction) const
19  {
20    for(size_t j=0;j<k_sorted.size();j++) 
21      prediction(target(k_sorted[j]))+=1.0/distance(k_sorted[j]);           
22  }
23
24}}}
Note: See TracBrowser for help on using the repository browser.