[mlpack-git] master: don't hardcore Evaluate for the lovasz theta objective function (768ec81)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:09:51 EST 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit 768ec81bfe99e9235eb7229351bcdf4b6dc3b3d9
Author: Stephen Tu <tu.stephenl at gmail.com>
Date:   Fri Jan 2 14:20:47 2015 -0800

    don't hardcore Evaluate for the lovasz theta objective function


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

768ec81bfe99e9235eb7229351bcdf4b6dc3b3d9
 src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp b/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
index f6ac6ae..9bbdd22 100644
--- a/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
+++ b/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
@@ -34,7 +34,13 @@ LRSDPFunction::LRSDPFunction(const size_t numSparseConstraints,
 
 double LRSDPFunction::Evaluate(const arma::mat& coordinates) const
 {
-  return -accu(coordinates * trans(coordinates));
+  const arma::mat rrt = coordinates * trans(coordinates);
+  double objective = 0.;
+  if (hasSparseObjective())
+    objective += trace(SparseC() * rrt);
+  if (hasDenseObjective())
+    objective += trace(DenseC() * rrt);
+  return objective;
 }
 
 void LRSDPFunction::Gradient(const arma::mat& /* coordinates */,



More information about the mlpack-git mailing list