Add functions to access and modify parameters for training.

This commit is contained in:
Ryan Curtin
2021-03-05 09:29:29 -05:00
parent 88311f0668
commit 3bd4567bdf
2 changed files with 24 additions and 0 deletions
+4
View File
@@ -178,6 +178,10 @@ double LARS::Train(const arma::mat& matX,
isIgnored.clear();
matUtriCholFactor.reset();
// Update values in case lambda1 or lambda2 changed.
lasso = (lambda1 != 0);
elasticNet = (lambda1 != 0 && lambda2 != 0);
// This matrix may end up holding the transpose -- if necessary.
arma::mat dataTrans;
// dataRef is row-major.
+20
View File
@@ -249,6 +249,26 @@ class LARS
arma::rowvec& predictions,
const bool rowMajor = false) const;
//! Get the L1 regularization coefficient.
double Lambda1() const { return lambda1; }
//! Modify the L1 regularization coefficient.
double& Lambda1() { return lambda1; }
//! Get the L2 regularization coefficient.
double Lambda2() const { return lambda2; }
//! Modify the L2 regularization coefficient.
double& Lambda2() { return lambda2; }
//! Get whether to use the Cholesky decomposition.
bool UseCholesky() const { return useCholesky; }
//! Modify whether to use the Cholesky decomposition.
bool& UseCholesky() { return useCholesky; }
//! Get the tolerance for maximum correlation during training.
double Tolerance() const { return tolerance; }
//! Modify the tolerance for maximum correlation during training.
double& Tolerance() { return tolerance; }
//! Access the set of active dimensions.
const std::vector<size_t>& ActiveSet() const { return activeSet; }