/*--------------------------------------*/ virtual void writeText(const char *fn, int digits, bool doSparse=false, bool doAppend=false) const { AzIntArr ia; ia.range(0, colNum()); writeText(fn, &ia, digits, doSparse, doAppend); }
/*------------------------------------------------------------------*/ double AzTaskTools::analyzeLoss(AzLossType loss_type, const AzDvect *v_p, const AzDvect *v_y, const AzIntArr *inp_ia_dx, double p_coeff) { if (loss_type == AzLoss_None) { return -1; } const double *p = v_p->point(); const double *y = v_y->point(); AzIntArr iq; const AzIntArr *ia_dx = inp_ia_dx; if (ia_dx == NULL) { iq.range(0, v_p->rowNum()); ia_dx = &iq; } double total_loss = 0; int num; const int *dxs = ia_dx->point(&num); int ix; for (ix = 0; ix < num; ++ix) { int dx = dxs[ix]; double loss = AzLoss::getLoss(loss_type, p[dx]*p_coeff, y[dx]); total_loss += loss; } double avg_loss = 0; if (num > 0) { avg_loss = total_loss / (double)num; } return avg_loss; }
/*--------------------------------------*/ virtual void writeText(const char *fn, int digits) const { AzIntArr ia; ia.range(0, rowNum()); writeText(fn, &ia, digits); }