1 #ifndef _theplu_yat_classifier_igp_
2 #define _theplu_yat_classifier_igp_
27 #include "MatrixLookup.h"
29 #include "yat/utility/concept_check.h"
30 #include "yat/utility/Matrix.h"
31 #include "yat/utility/Vector.h"
32 #include "yat/utility/yat_assert.h"
34 #include <boost/concept_check.hpp>
42 namespace classifier {
62 template <
typename Distance>
104 template <
typename Distance>
106 : matrix_(data), target_(target)
112 template <
typename Distance>
114 const Distance& dist)
115 : matrix_(data), target_(target), distance_(dist)
122 template <
typename Distance>
128 template <
typename Distance>
131 YAT_ASSERT(target_.size()==matrix_.columns());
134 igp_.resize(target_.nof_classes(), 0.0);
138 for (
size_t i=0; i<dist.rows(); ++i)
139 for (
size_t j=i+1; j<dist.rows(); ++j) {
140 dist(i,j) = dist(j,i) = distance_(matrix_.begin_column(i),
141 matrix_.end_column(i),
142 matrix_.begin_column(j));
146 for(
size_t i=0; i<target_.size(); i++) {
149 for(
size_t j=0; j<target_.size(); j++) {
152 if(dist(i,j)<mindist) {
157 if(target_(i)==target_(neighbor))
161 for(
size_t i=0; i<target_.nof_classes(); i++) {
162 igp_(i)/=
static_cast<double>(target_.size(i));
167 template <
typename Distance>
General view into utility::Matrix.
Definition: MatrixLookup.h:70
Class for containing sample labels.
Definition: Target.h:47
IGP(const MatrixLookup &, const Target &)
Definition: IGP.h:105
Class for In Group Proportions (IGP)
Definition: IGP.h:63
virtual ~IGP()
Definition: IGP.h:123
T max(const T &a, const T &b, const T &c)
Definition: stl_utility.h:697
This is the yat interface to GSL vector.
Definition: Vector.h:57
const utility::Vector & score(void) const
Definition: IGP.h:168
Concept check for a Distance.
Definition: concept_check.h:278
Interface to GSL matrix.
Definition: Matrix.h:63