SHOGUN  6.0.0
BruteKNNSolver.h
Go to the documentation of this file.
1 /* This software is distributed under BSD 3-clause license (see LICENSE file).
2  *
3  * Copyright (c) 2012-2013 Sergey Lisitsyn
4  */
5 
6 #ifndef BRUTESOLVER_H__
7 #define BRUTESOLVER_H__
8 
9 #include <shogun/lib/config.h>
10 
11 #include <shogun/lib/common.h>
14 
15 namespace shogun
16 {
17 
18 /* Standard KNN solver. Test points are compared to all training data for each prediction. */
20 {
21  public:
24  {
25  init();
26  }
27 
29  virtual ~CBruteKNNSolver() { /* nothing to do */ }
30 
40  CBruteKNNSolver(const int32_t k, const float64_t q, const int32_t num_classes, const int32_t min_label, const SGVector<int32_t> train_labels, const SGMatrix<index_t> NN);
41 
42  virtual CMulticlassLabels* classify_objects(CDistance* d, const int32_t num_lab, SGVector<int32_t>& train_lab, SGVector<float64_t>& classes) const;
43 
44  virtual SGVector<int32_t> classify_objects_k(CDistance* d, const int32_t num_lab, SGVector<int32_t>& train_lab, SGVector<int32_t>& classes) const;
45 
47  const char* get_name() const { return "BruteKNNSolver"; }
48 
49  private:
50  void init()
51  {
52  nn=SGMatrix<index_t>(3, 0);
53  }
54 
55  protected:
58 
59 };
60 
61 }
62 #endif
Class Distance, a base class for all the distances used in the Shogun toolbox.
Definition: Distance.h:87
virtual CMulticlassLabels * classify_objects(CDistance *d, const int32_t num_lab, SGVector< int32_t > &train_lab, SGVector< float64_t > &classes) const
virtual SGVector< int32_t > classify_objects_k(CDistance *d, const int32_t num_lab, SGVector< int32_t > &train_lab, SGVector< int32_t > &classes) const
Multiclass Labels for multi-class classification.
double float64_t
Definition: common.h:60
SGMatrix< index_t > nn
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
const char * get_name() const

SHOGUN Machine Learning Toolbox - Documentation