From 49b38fe79310b4db65270e63d59f2eb86cb4e6cc Mon Sep 17 00:00:00 2001 From: ippei ito Date: Thu, 12 Mar 2015 00:32:17 +0900 Subject: [PATCH 1/2] Fixed compile error build with VisualStudio2013 on windows. REG_NONE defined in ml.hpp conflicts with defined in Winnt.h --- modules/ml/include/opencv2/ml.hpp | 2 +- modules/ml/src/lr.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ml/include/opencv2/ml.hpp b/modules/ml/include/opencv2/ml.hpp index c7559aea52..8959c58d84 100644 --- a/modules/ml/include/opencv2/ml.hpp +++ b/modules/ml/include/opencv2/ml.hpp @@ -1339,7 +1339,7 @@ public: //! Regularization kinds enum RegKinds { - REG_NONE = -1, //!< Regularization disabled + REG_DISABLE = -1, //!< Regularization disabled REG_L1 = 0, //!< %L1 norm REG_L2 = 1 //!< %L2 norm }; diff --git a/modules/ml/src/lr.cpp b/modules/ml/src/lr.cpp index e621009981..06ac0bce01 100644 --- a/modules/ml/src/lr.cpp +++ b/modules/ml/src/lr.cpp @@ -322,7 +322,7 @@ double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels theta_b = _init_theta(Range(1, n), Range::all()); multiply(theta_b, theta_b, theta_c, 1); - if(params.norm != REG_NONE) + if (params.norm != REG_DISABLE) { llambda = 1; } @@ -377,7 +377,7 @@ Mat LogisticRegressionImpl::compute_batch_gradient(const Mat& _data, const Mat& m = _data.rows; n = _data.cols; - if(params.norm != REG_NONE) + if (params.norm != REG_DISABLE) { llambda = 1; } @@ -449,7 +449,7 @@ Mat LogisticRegressionImpl::compute_mini_batch_gradient(const Mat& _data, const Mat data_d; Mat labels_l; - if(params.norm != REG_NONE) + if (params.norm != REG_DISABLE) { lambda_l = 1; } From 518fd59a105d71da202c50c8c52fd20ba33e6add Mon Sep 17 00:00:00 2001 From: ippei ito Date: Thu, 12 Mar 2015 01:09:15 +0900 Subject: [PATCH 2/2] fixed whitespace error --- modules/ml/src/lr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ml/src/lr.cpp b/modules/ml/src/lr.cpp index 06ac0bce01..5a057a205f 100644 --- a/modules/ml/src/lr.cpp +++ b/modules/ml/src/lr.cpp @@ -322,7 +322,7 @@ double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels theta_b = _init_theta(Range(1, n), Range::all()); multiply(theta_b, theta_b, theta_c, 1); - if (params.norm != REG_DISABLE) + if (params.norm != REG_DISABLE) { llambda = 1; } @@ -377,7 +377,7 @@ Mat LogisticRegressionImpl::compute_batch_gradient(const Mat& _data, const Mat& m = _data.rows; n = _data.cols; - if (params.norm != REG_DISABLE) + if (params.norm != REG_DISABLE) { llambda = 1; } @@ -449,7 +449,7 @@ Mat LogisticRegressionImpl::compute_mini_batch_gradient(const Mat& _data, const Mat data_d; Mat labels_l; - if (params.norm != REG_DISABLE) + if (params.norm != REG_DISABLE) { lambda_l = 1; }