source: branches/0.4-stable/yat/classifier/KNN_ReciprocalDistance.cc @ 1276

Last change on this file since 1276 was 1251, checked in by Peter, 13 years ago

make distcheck works - fixes ticket:217

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