MLPACK
1.0.11
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
mlpack
methods
lars
lars.hpp
Go to the documentation of this file.
1
34
#ifndef __MLPACK_METHODS_LARS_LARS_HPP
35
#define __MLPACK_METHODS_LARS_LARS_HPP
36
37
#include <
mlpack/core.hpp
>
38
39
namespace
mlpack {
40
namespace
regression {
41
42
// beta is the estimator
43
// yHat is the prediction from the current estimator
44
99
class
LARS
100
{
101
public
:
112
LARS
(
const
bool
useCholesky
,
113
const
double
lambda1
= 0.0,
114
const
double
lambda2
= 0.0,
115
const
double
tolerance
= 1e-16);
116
129
LARS
(
const
bool
useCholesky,
130
const
arma::mat& gramMatrix,
131
const
double
lambda1
= 0.0,
132
const
double
lambda2
= 0.0,
133
const
double
tolerance
= 1e-16);
134
149
void
Regress
(
const
arma::mat& data,
150
const
arma::vec& responses,
151
arma::vec& beta,
152
const
bool
transposeData =
true
);
153
155
const
std::vector<size_t>&
ActiveSet
()
const
{
return
activeSet
; }
156
159
const
std::vector<arma::vec>&
BetaPath
()
const
{
return
betaPath
; }
160
163
const
std::vector<double>&
LambdaPath
()
const
{
return
lambdaPath
; }
164
166
const
arma::mat&
MatUtriCholFactor
()
const
{
return
matUtriCholFactor
; }
167
168
// Returns a string representation of this object.
169
std::string
ToString
()
const
;
170
171
private
:
173
arma::mat
matGramInternal
;
174
176
const
arma::mat&
matGram
;
177
179
arma::mat
matUtriCholFactor
;
180
182
bool
useCholesky
;
183
185
bool
lasso
;
187
double
lambda1
;
188
190
bool
elasticNet
;
192
double
lambda2
;
193
195
double
tolerance
;
196
198
std::vector<arma::vec>
betaPath
;
199
201
std::vector<double>
lambdaPath
;
202
204
std::vector<size_t>
activeSet
;
205
207
std::vector<bool>
isActive
;
208
209
// Set of variables that are ignored (if any).
210
212
std::vector<size_t>
ignoreSet
;
213
215
std::vector<bool>
isIgnored
;
216
222
void
Deactivate
(
const
size_t
activeVarInd);
223
229
void
Activate
(
const
size_t
varInd);
230
236
void
Ignore
(
const
size_t
varInd);
237
238
// compute "equiangular" direction in output space
239
void
ComputeYHatDirection
(
const
arma::mat& matX,
240
const
arma::vec& betaDirection,
241
arma::vec& yHatDirection);
242
243
// interpolate to compute last solution vector
244
void
InterpolateBeta
();
245
246
void
CholeskyInsert
(
const
arma::vec& newX,
const
arma::mat& X);
247
248
void
CholeskyInsert
(
double
sqNormNewX,
const
arma::vec& newGramCol);
249
250
void
GivensRotate
(
const
arma::vec::fixed<2>& x,
251
arma::vec::fixed<2>& rotatedX,
252
arma::mat& G);
253
254
void
CholeskyDelete
(
const
size_t
colToKill);
255
};
256
257
};
// namespace regression
258
};
// namespace mlpack
259
260
#endif
Generated by
1.8.3.1