[mlpack-svn] r11707 - mlpack/trunk/src/mlpack/methods/mvu
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Mar 2 18:49:24 EST 2012
Author: rcurtin
Date: 2012-03-02 18:49:24 -0500 (Fri, 02 Mar 2012)
New Revision: 11707
Modified:
mlpack/trunk/src/mlpack/methods/mvu/mvu.cpp
mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp
Log:
Maybe it works, but I'm not totally sure.
Modified: mlpack/trunk/src/mlpack/methods/mvu/mvu.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/mvu/mvu.cpp 2012-03-02 23:08:31 UTC (rev 11706)
+++ mlpack/trunk/src/mlpack/methods/mvu/mvu.cpp 2012-03-02 23:49:24 UTC (rev 11707)
@@ -26,20 +26,22 @@
{
// First we have to choose the output point. We'll take a linear projection
// of the data for now (this is probably not a good final solution).
- outputData = trans(data.rows(0, newDim));
+// outputData = trans(data.rows(0, newDim - 1));
+ // Following Nick's idea.
+ outputData.randu(data.n_cols, newDim);
// The number of constraints is the number of nearest neighbors plus one.
LRSDP mvuSolver(numNeighbors * data.n_cols + 1, outputData);
// Set up the objective. Because we are maximizing the trace of (R R^T),
// we'll instead state it as min(-I_n * (R R^T)), meaning C() is -I_n.
- mvuSolver.C().eye(newDim, newDim);
+ mvuSolver.C().eye(data.n_cols, data.n_cols);
mvuSolver.C() *= -1;
// Now set up each of the constraints.
// The first constraint is trace(ones * R * R^T) = 0.
mvuSolver.B()[0] = 0;
- mvuSolver.A()[0].ones(newDim, newDim);
+ mvuSolver.A()[0].ones(data.n_cols, data.n_cols);
// All of our other constraints will be sparse except the first. So set that
// vector of modes accordingly.
@@ -66,7 +68,7 @@
arma::mat& aRef = mvuSolver.A()[index];
- aRef.set_size(2, 4);
+ aRef.set_size(3, 4);
// A_ij(i, i) = 1.
aRef(0, 0) = i;
Modified: mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp 2012-03-02 23:08:31 UTC (rev 11706)
+++ mlpack/trunk/src/mlpack/methods/mvu/mvu_main.cpp 2012-03-02 23:49:24 UTC (rev 11707)
@@ -31,6 +31,8 @@
// Read from command line.
CLI::ParseCommandLine(argc, argv);
+ math::RandomSeed(time(NULL));
+
// Load input dataset.
const string inputFile = CLI::GetParam<string>("input_file");
mat data;
More information about the mlpack-svn
mailing list