void callProcG(TreeHist* treeh) { FeatureTree* ginfo[MAXNUMFS]; ginfo[0] = FeatureTree::root(); int cVal = (*Feature::conditionedEvent)(treeh); if(cVal < 0) return; int i; for(i = 1 ; i <= Feature::total[Feature::whichInt] ; i++) processG(i, ginfo, treeh, cVal); double total = 0; double postLam[MAXNUMFS]; double percents[MAXNUMFS]; double remainingProb = 1.0; for(i = Feature::total[Feature::whichInt] ; i > 0 ; i--) { postLam[i] = unsmoothedPs[i]*(remainingProb*lambdas[i]); total += postLam[i]; remainingProb *= 1-lambdas[i]; } for(i = Feature::total[Feature::whichInt] ; i > 0 ; i--) { //if(procGSwitch) //cerr<< i <<" "<<unsmoothedPs[i] << " " << lambdas[i] << " " << postLam[i] << endl; } remainingProb = 1.0; for(i = Feature::total[Feature::whichInt] ; i > 0 ; i--) { int b = bucketVals[i]; if(!procGSwitch) { trData[i][b].c++; continue; } trData[i][b].c +=remainingProb; double incr = 0; if(total*remainingProb > 0) incr = postLam[i]/total*remainingProb; else { cerr << postLam[i] << " " << total << " " << remainingProb << endl; assert(postLam[i] == 0); } trData[i][b].pm += incr; //if(b == 13) cerr << "TT "<< i << " " << remainingProb << " " << incr // << " " << trData[i][b].c << " " << trData[i][b].pm // << endl; remainingProb *= 1-lambdas[i]; total -= postLam[i]; if(total < 0) { //cerr << "Bad total " << total << endl; total = 0; } } }
void callProcG(TreeHist* treeh) { int i; for(i = 0 ; i < 20 ; i++) nfeatVs[i] = -1; FeatureTree* ginfo[MAXNUMFS]; ginfo[0] = FeatureTree::root(); int cVal = (*Feature::conditionedEvent)(treeh); if(cVal < 0) return; for(i = 1 ; i <= Feature::total[Feature::whichInt] ; i++) processG(i, ginfo, treeh, cVal); }