[mlpack-git] [mlpack/mlpack] Added the discretize function. Design changes as discussed. (#703)

Marcus Edel notifications at github.com
Sun Jun 26 14:04:30 EDT 2016


> +    arma::uvec z2 = arma::shuffle(lis1);
> +    for (size_t i = 0; i < zs.n_rows; ++i)
> +      zs(i, j) = (labels(i, z1(j)) == labels(i, z2(j))) ? 1 : 0;
> +  }
> +  for (size_t i = 0; i < zs.n_cols; ++i)
> +    zs.row(i) -= arma::mean(zs, 0); // calculate mean about rows. n_rows = 20000.
> +  size_t ind = 0;
> +  arma::uvec k = arma::find(zs > 0);
> +  if ( k.n_elem == 0)
> +  {
> +    DiscreteLabels.ones();
> +  }
> +  else
> +  {
> +    //find most representative label (closest to mean)
> +    arma::vec k = arma::sum(arma::abs(zs), 0);

As pointed out here: http://arma.sourceforge.net/docs.html#sum ``arma::sum(..., 0)`` returns a ``rowvec``, arma::vec is a ``colvec``.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/703/files/987f0790f745314a2117a87f28a346b05a8a2a2d#r68506617
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160626/0de2c198/attachment.html>


More information about the mlpack-git mailing list