Beispiel #1
0
 virtual void show_stat(AzBytArr &s) const {
   if (p.typ == AzpActivDflt_None) return;     
   if (!p.do_stat) return; 
   AzDvect my_v_pop(&v_pop_last); 
   my_v_pop.normalize1(); 
   s.nl(); 
   double accum = 0; 
   int ix; 
   for (ix = 0; ix < my_v_pop.rowNum(); ++ix) {
     accum += my_v_pop.get(ix); 
     s.c("b"); s.cn(v_border.get(ix)); s.c("="); s.cn(my_v_pop.get(ix),3); s.c("("); s.cn(accum,3); s.c("),"); 
   }
 }
Beispiel #2
0
  virtual void format(AzBytArr &s, bool do_reset=false) const {
    if (do_reset) s.reset(); 
//    s.c("("); 
    int ix; 
    for (ix = 0; ix < ia_sz.size(); ++ix) {
      if (ix > 0) s.c(" x "); 
      s.cn(ia_sz.get(ix)); 
    }
//    s.c(")"); 
  }  
Beispiel #3
0
 void writeText(const char *fn) const {
   AzFile file(fn); 
   file.open("wb"); 
   int ix; 
   for (ix = 0; ix < num; ++ix) {
     AzBytArr s; s.cn(ints[ix]); s.nl(); 
     s.writeText(&file);  
   }
   file.close(true); 
 }
Beispiel #4
0
 inline void print(const char *name, T val, int width_prec=-1, 
                   bool doZero_doSci=false) {
   if (o == NULL) return; 
   itemBegin(); 
   if (name != NULL) {
     *o<<name; 
     if (name_dlm != NULL) *o<<name_dlm; 
   }
   AzBytArr s; s.cn(val, width_prec, doZero_doSci);
   *o<<s.c_str(); 
 }
/*--------------------------------------------------------*/
void AzTreeEnsemble::show_weights(const AzOut &out, AzSvFeatInfo *fi) const
{
  AzIIFarr iifa_tx_nx_posiw, iifa_tx_nx_negaw; 
  int tx; 
  for (tx = 0; tx < t_num; ++tx) {
    int nx; 
    for (nx = 0; nx < t[tx]->nodeNum(); ++nx) {
      const AzTreeNode *np = t[tx]->node(nx); 
      if (np->weight > 0) {
        iifa_tx_nx_posiw.put(tx, nx, np->weight); 
      }
      else if (np->weight < 0) {
        iifa_tx_nx_negaw.put(tx, nx, np->weight); 
      }
    }
  }
  iifa_tx_nx_posiw.sort_Float(false); /* descending order */
  iifa_tx_nx_negaw.sort_Float(true); /* ascending order */

  AzPrint::writeln(out, "Positive weights -------------------"); 
  int ix; 
  for (ix = 0; ix < iifa_tx_nx_posiw.size(); ++ix) {
    int tx, nx; 
    double w = iifa_tx_nx_posiw.get(ix, &tx, &nx); 
    AzBytArr s_desc; 
    t[tx]->genDesc(fi, nx, &s_desc); 
    AzBytArr s; s.cn(w, 6, false); s.c(' '); s.c(&s_desc); 
    AzPrint::writeln(out, s); 
  }

  AzPrint::writeln(out, "Negative weights -------------------"); 
  for (ix = 0; ix < iifa_tx_nx_negaw.size(); ++ix) {
    int tx, nx; 
    double w = iifa_tx_nx_negaw.get(ix, &tx, &nx); 
    AzBytArr s_desc; 
    t[tx]->genDesc(fi, nx, &s_desc); 
    AzBytArr s; s.cn(w, 6, false); s.c(' '); s.c(&s_desc); 
    AzPrint::writeln(out, s); 
  }
}
 /*--------------------------------------*/
 virtual void writeText(const char *fn, const AzIntArr *ia, int digits) const {
   AzFile file(fn); 
   file.open("wb"); 
   AzBytArr s;
   int ix; 
   for (ix = 0; ix < ia->size(); ++ix) {
     int row = ia->get(ix);  
     double val = get(row); 
     s.cn(val, digits); 
     s.nl(); 
   }
   s.writeText(&file); 
   file.close(true); 
 }
Beispiel #7
0
 inline static void print(int number, const char *msg, const AzOut &out) {
   AzBytArr s; s.cn(number); 
   print(s.c_str(), msg, out); 
 }