Example #1
0
 virtual void copy_from(const AzpActivDflt *i) {
   p = i->p; 
   m_drv.set(&i->m_drv); 
   v_border.set(&i->v_border); 
   v_pop.set(&i->v_pop); 
   v_pop_last.set(&i->v_pop_last); 
 }   
 void reset(const AzTrTtarget *inp) {
   if (inp != NULL) {
     v_tar_dw.set(&inp->v_tar_dw); 
     v_dw.set(&inp->v_dw); 
     v_y.set(&inp->v_y); 
     v_fixed_dw.set(&inp->v_fixed_dw); 
     fixed_dw_sum = inp->fixed_dw_sum; 
   }
 }
Example #3
0
/*-------------------------------------------------------------*/
void AzDmat::prod(const AzDmat *m0, const AzDmat *m1, bool is_m0_tran, bool is_m1_tran)
{
  const char *eyec = "AzDmat::prod"; 
  if (is_m1_tran) {
    throw new AzException(eyec, "No support for the transpose of the second matrix"); 
  }
  if (is_m0_tran) {
    reform(m0->colNum(), m1->colNum()); 
    for (int col = 0; col < m1->colNum(); ++col) {
      AzDvect *myv = col_u(col); 
      const AzDvect *v1 = m1->col(col); 
      for (int row = 0; row < rowNum(); ++row) {
        double val = m0->col(col)->innerProduct(v1); 
        myv->set(row, val); 
      }
    }
  }
  else {
    reform(m0->rowNum(), m1->colNum()); 
    for (int col = 0; col < m1->colNum(); ++col) {
      AzDvect *myv = col_u(col); 
      const AzDvect *v1 = m1->col(col); 
      for (int row1 = 0; row1 < v1->rowNum(); ++row1) {
        myv->add(m0->col(row1), v1->get(row1)); 
      }
    }      
  }
}
  void reset(const AzDvect *inp_v_y, 
             const AzDvect *inp_v_fixed_dw=NULL) {
    v_dw.reform(inp_v_y->rowNum()); 
    v_dw.set(1); 
    v_tar_dw.set(inp_v_y); 
    v_y.set(inp_v_y);
    fixed_dw_sum = -1; 

    v_fixed_dw.reset(); 
    if (!AzDvect::isNull(inp_v_fixed_dw)) {
      v_fixed_dw.set(inp_v_fixed_dw); 
      if (v_fixed_dw.rowNum() != v_y.rowNum()) {
        throw new AzException(AzInputError, "AzTrTtarget::reset", 
                              "conlict in dimensionality: y and data point weights"); 
      }
      fixed_dw_sum = v_fixed_dw.sum(); 
    }
  }
 AzSortedFeat_Sparse & operator =(const AzSortedFeat_Sparse &inp) { /* never tested */
   if (this == &inp) return *this; 
   ia_zero.reset(&inp.ia_zero); 
   ia_index.reset(&inp.ia_index); 
   v_value.set(&inp.v_value); 
   _shouldDoBackward = inp._shouldDoBackward; 
   data_num = inp.data_num; 
   return *this; 
 }
Example #6
0
  /*---  to keep count  ---*/
  void init_count() {
//    const double border[] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 9999999999, -1};  
    #define AzpActivDfltCountStop  7777
    const double border[] = {-1e+10, -10, -5, -1, -0.5, -0.2, -0.1, 0, 0.1, 0.2, 0.5, 1, 5, 10, 1e+10, AzpActivDfltCountStop}; 
    int num = 0; 
    int ix; 
    for (ix = 0; ; ++ix, ++num) if (border[ix] == AzpActivDfltCountStop) break;
    v_border.set(border, num); 
    v_pop.reform(num);   
  }
 /*---*/
 void resetDw(const AzDvect *inp_v_dw) {
   if (!AzDvect::isNull(inp_v_dw)) {
     if (inp_v_dw->rowNum() != v_y.rowNum()) {
       throw new AzException("AzOptOnTree::resetDw", "dimensionality conflict"); 
     }
     v_fixed_dw.set(inp_v_dw); 
   }
   else {
     v_fixed_dw.destroy(); 
   }
 }
Example #8
0
 void end_of_epoch() {
   if (p.typ == AzpActivDflt_None) return; 
   v_pop_last.set(&v_pop); 
   v_pop.zeroOut(); 
 }
 void resetTarDw_residual(const AzDvect *v_p) { /* only for LS */
   v_tar_dw.set(&v_y); 
   v_tar_dw.add(v_p, -1); 
 }
Example #10
0
 void resetTargetDw(const AzDvect *v_tar, const AzDvect *inp_v_dw) {
   v_tar_dw.set(v_tar); 
   v_dw.set(inp_v_dw); 
   v_tar_dw.scale(&v_dw); /* component-wise multiplication */
 }