Beispiel #1
0
void NCA<MetricType, OptimizerType>::LearnDistance(arma::mat& outputMatrix)
{
  // See if we were passed an initialized matrix.
  if ((outputMatrix.n_rows != dataset.n_rows) ||
      (outputMatrix.n_cols != dataset.n_rows))
    outputMatrix.eye(dataset.n_rows, dataset.n_rows);

  Timer::Start("nca_sgd_optimization");

  optimizer.Optimize(outputMatrix);

  Timer::Stop("nca_sgd_optimization");
}
Beispiel #2
0
 MyFunc2(int dim):ObjectFunc(dim){
     W.eye(dim,dim);
     b = arma::randu(dim);
     
     x_init = std::make_shared<arma::vec>(dim,arma::fill::randn);
 }