[mlpack-svn] r14303 - mlpack/trunk/src/mlpack/methods/lars
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Feb 14 08:16:10 EST 2013
Author: rcurtin
Date: 2013-02-14 08:16:10 -0500 (Thu, 14 Feb 2013)
New Revision: 14303
Modified:
mlpack/trunk/src/mlpack/methods/lars/lars.cpp
mlpack/trunk/src/mlpack/methods/lars/lars.hpp
Log:
Change rowMajor parameter to transposeData parameter, which is set to true by
default. This is in line with the LARS executable and fixes a bug; the LARS
executable transposed the data when it should not have.
Modified: mlpack/trunk/src/mlpack/methods/lars/lars.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/lars/lars.cpp 2013-02-14 01:48:12 UTC (rev 14302)
+++ mlpack/trunk/src/mlpack/methods/lars/lars.cpp 2013-02-14 13:16:10 UTC (rev 14303)
@@ -39,15 +39,15 @@
void LARS::Regress(const arma::mat& matX,
const arma::vec& y,
arma::vec& beta,
- const bool rowMajor)
+ const bool transposeData)
{
Timer::Start("lars_regression");
// This matrix may end up holding the transpose -- if necessary.
arma::mat dataTrans;
// dataRef is row-major.
- const arma::mat& dataRef = (rowMajor ? matX : dataTrans);
- if (!rowMajor)
+ const arma::mat& dataRef = (transposeData ? dataTrans : matX);
+ if (transposeData)
dataTrans = trans(matX);
// Compute X' * y.
Modified: mlpack/trunk/src/mlpack/methods/lars/lars.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/lars/lars.hpp 2013-02-14 01:48:12 UTC (rev 14302)
+++ mlpack/trunk/src/mlpack/methods/lars/lars.hpp 2013-02-14 13:16:10 UTC (rev 14303)
@@ -123,19 +123,19 @@
* column-major -- each column is an observation and each row is a dimension.
* However, because LARS is more efficient on a row-major matrix, this method
* will (internally) transpose the matrix. If this transposition is not
- * necessary (i.e., you want to pass in a row-major matrix), pass 'true' for
- * the rowMajor parameter.
+ * necessary (i.e., you want to pass in a row-major matrix), pass 'false' for
+ * the transposeData parameter.
*
* @param data Column-major input data (or row-major input data if rowMajor =
* true).
* @param responses A vector of targets.
* @param beta Vector to store the solution (the coefficients) in.
- * @param rowMajor Set to true if matX is row-major.
+ * @param rowMajor Set to false if the data is row-major.
*/
void Regress(const arma::mat& data,
const arma::vec& responses,
arma::vec& beta,
- const bool rowMajor = false);
+ const bool transposeData = true);
//! Access the set of active dimensions.
const std::vector<size_t>& ActiveSet() const { return activeSet; }
More information about the mlpack-svn
mailing list