DataSlingers/clustRviz

Code Clean-Ups

Opened this issue · 0 comments

Various things to clean-up after #112:

  • Various signed / unsigned comparison issues flagged by compiler. (Addressed by #122)

  • User configurable stopping parameters for exact = TRUE mode. Specifically, the convergence threshold and maximum iterations should be settable via clustRviz_options. (Addressed by #122)

  • reset_aux is now malignant and should be removed to increase performance of exact = TRUE. (Addressed by #117)

  • Calls to full_admm_step are now redundant and can be elided. (Addressed by #117)

  • The gamma values used in exact = TRUE and exact = FALSE don't line up. (See script in comments on #112)

  • Stopping criteria for clustering_impl.h and biclustering_impl.h don't line up. (Addressed by #117 and #122)

  • We should split MatrixProx into MatrixRowProx (current) and MatrixColProx to avoid unnecessary transposes: (Addressed by #117)

Eigen::MatrixXd MatrixColProx(const Eigen::MatrixXd& X,
                              double lambda,
                              const Eigen::VectorXd& weights,
                              bool l1 = true){
  Eigen::Index n = X.rows();
  Eigen::Index p = X.cols();

  Eigen::MatrixXd V(n, p);

  if(l1){
    for(Eigen::Index i = 0; i < n; i++){
      for(Eigen::Index j = 0; j < p; j++){
        V(i, j) = soft_thresh(X(i, j), lambda * weights(j));
      }
    }
  } else {
    for(Eigen::Index j = 0; j < p; j++){
      Eigen::VectorXd X_j = X.col(j);
      double scale_factor = 1 - lambda * weights(j) / X_j.norm();

      if(scale_factor > 0){
        V.col(j) = X_j * scale_factor;
      } else {
        V.col(j).setZero();
      }
    }
  }

  return V;
}
  • @dansenglund should be added to the DESCRIPTION file as an author. (Addressed by #117)

Will add more as I think of them.