SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
KRRNystrom.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) The Shogun Machine Learning Toolbox
4  * Written (W) 2016 Fredrik Hallgren
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * The views and conclusions contained in the software and documentation are those
28  * of the authors and should not be interpreted as representing official policies,
29  * either expressed or implied, of the Shogun Development Team.
30  */
31 
32 #ifndef _KRRNYSTROM_H__
33 #define _KRRNYSTROM_H__
34 
36 
37 namespace shogun {
38 
65 {
66 public:
68 
70  CKRRNystrom();
71 
79  CKRRNystrom(float64_t tau, int32_t m, CKernel* k, CLabels* lab);
80 
82  virtual ~CKRRNystrom() {}
83 
88  inline void set_num_rkhs_basis(int32_t m)
89  {
91 
92  if (kernel!=NULL)
93  {
94  int32_t n=kernel->get_num_vec_lhs();
95 
96  REQUIRE(m_num_rkhs_basis<=n, "Number of sampled rows (%d) must be \
97 less than number of data points (%d)\n", m_num_rkhs_basis, n);
98  }
99 
100  };
101 
103  virtual const char* get_name() const { return "KRRNystrom"; }
104 
105 protected:
110  virtual bool solve_krr_system();
111 
117 
120 
121 private:
122  void init();
123 
124 };
125 
126 }
127 
128 #endif // _KRRNYSTROM_H__
MACHINE_PROBLEM_TYPE(PT_REGRESSION)
int32_t m_num_rkhs_basis
Definition: KRRNystrom.h:119
Class KernelRidgeRegression implements Kernel Ridge Regression - a regularized least square method fo...
virtual const char * get_name() const
Definition: KRRNystrom.h:103
SGVector< int32_t > subsample_indices()
Definition: KRRNystrom.cpp:64
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
#define REQUIRE(x,...)
Definition: SGIO.h:206
virtual int32_t get_num_vec_lhs()
Definition: Kernel.h:517
virtual bool solve_krr_system()
Definition: KRRNystrom.cpp:78
double float64_t
Definition: common.h:50
virtual ~CKRRNystrom()
Definition: KRRNystrom.h:82
void set_num_rkhs_basis(int32_t m)
Definition: KRRNystrom.h:88
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
Class KRRNystrom implements the Nyström method for kernel ridge regression, using a low-rank approxim...
Definition: KRRNystrom.h:64
The Kernel base class.
Definition: Kernel.h:159

SHOGUN Machine Learning Toolbox - Documentation