kisungyou / Rdimtools

Dimension Reduction and Estimation Methods
https://kisungyou.com/Rdimtools
Other
52 stars 10 forks source link

question about selecting landmark points by MaxMin #18

Open weigcdsb opened 12 months ago

weigcdsb commented 12 months ago

Hello, I'm kind of confused by the landmark points selction. It seems the strategy is not exactly as the original MaxMin? It's kind of like the "MinSum" strategy? (testdists += pD(testpt,targetpt);) Or could you explain why it's equivalent to MaxMin?

Thanks a lot!


int aux_landmarkMaxMin(arma::mat& pD, arma::vec& plandmark, arma::vec& seqnp){
  // 4-1. basic setting
  const int nlandmark = plandmark.n_elem;
  const int ntestpts  = seqnp.n_elem;

  // 4-2. we should be careful ; -1 for both vectors
  vec veclandmark = plandmark - 1;
  vec vecseqnp    = seqnp - 1;

  // 4-3. main iteration
  int currentidx      = 0;
  double currentdists = 123456789;
  for (int i=0;i<ntestpts;i++){
    int testpt       = vecseqnp(i);
    double testdists = 0;
    for (int j=0;j<nlandmark;j++){
      int targetpt = veclandmark(j);
      testdists += pD(testpt,targetpt);
    }
    if (testdists<currentdists){
      currentidx   = testpt;
      currentdists = testdists;
    }
  }
  currentidx += 1;

  // 4-4. return output
  return(currentidx);
}
weigcdsb commented 12 months ago

OK, a follow up... I implement the original MaxMin method by myself and fix the starting points, the results are different... These 2 methods are different, would you mind explaining why you choose select landmark by this rather using original MaxMin strategy?