[mlpack-git] master: fix bug--return wrong feature size (8692a76)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Sep 30 09:27:25 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/8a8b708650f72c2aecbd9b4a12c8b16b4e0a3508...dc2c5c68dc4bfcdd2075b1a0fd2d641fce651669

>---------------------------------------------------------------

commit 8692a76c491274ce9462271fee44558332299369
Author: stereomatchingkiss <stereomatchingkiss at gmail.com>
Date:   Wed Sep 30 12:24:10 2015 +0800

    fix bug--return wrong feature size


>---------------------------------------------------------------

8692a76c491274ce9462271fee44558332299369
 src/mlpack/methods/softmax_regression/softmax_regression.hpp          | 3 ++-
 src/mlpack/methods/softmax_regression/softmax_regression_function.hpp | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/methods/softmax_regression/softmax_regression.hpp b/src/mlpack/methods/softmax_regression/softmax_regression.hpp
index 8875421..a547ac6 100644
--- a/src/mlpack/methods/softmax_regression/softmax_regression.hpp
+++ b/src/mlpack/methods/softmax_regression/softmax_regression.hpp
@@ -163,7 +163,8 @@ class SoftmaxRegression
 
   //! Gets the features size of the training data
   size_t FeatureSize() const
-  { return parameters.n_rows; }
+  { return fitIntercept ? parameters.n_cols - 1 :
+                          parameters.n_cols; }
 
   /**
    * Serialize the SoftmaxRegression model. 
diff --git a/src/mlpack/methods/softmax_regression/softmax_regression_function.hpp b/src/mlpack/methods/softmax_regression/softmax_regression_function.hpp
index 01fe6d7..e56355f 100644
--- a/src/mlpack/methods/softmax_regression/softmax_regression_function.hpp
+++ b/src/mlpack/methods/softmax_regression/softmax_regression_function.hpp
@@ -113,7 +113,8 @@ class SoftmaxRegressionFunction
 
   //! Gets the features size of the training data
   size_t FeatureSize() const
-  { return initialPoint.n_rows; }
+  { return fitIntercept ? initialPoint.n_cols - 1 :
+                          initialPoint.n_cols; }
 
   //! Sets the regularization parameter.
   double& Lambda() { return lambda; }



More information about the mlpack-git mailing list