i using randomforest model in r .
for large numbers of trees program takes long time complete .
in "randomforest" function can use "do.trace=true" see real time progress . sample out put in real time on r console follows
ntree oob 1 2 3 4 5 6 7 8 9 100: 2.31% 7.14% 2.08% 0.00% 2.25% 10.81% 0.90% 0.00% 0.00% 1.72% 200: 1.95% 7.14% 2.08% 0.00% 2.25% 8.11% 0.00% 0.00% 0.00% 1.72% 300: 1.78% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 1.72% 400: 1.95% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 3.45% 500: 1.78% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 1.72% 600: 1.78% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 1.72% 700: 1.78% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 1.72% 800: 1.78% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 1.72% 900: 1.78% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 1.72% 1000: 1.78% 7.14% 2.08% 0.00% 1.69% 8.11% 0.00% 0.00% 0.00% 1.72%
the first row (100: 2.31% ....) comes first. after 1 second comes 2nd row , on. modify output .
when 1st row come , need grab "100" whole line , show "100" on r console instead of showing whole line. rest of rows.
[ tried sink(). not work sink
writes complete output output file ]
[i searched do.trace
option in randomforest function. lost myself suspect calls come c program; although not sure.]
i grab real time output on r console.
note : have seen following issues .
downloaded: https://cran.r-project.org/src/contrib/randomforest_4.6-10.tar.gz
when looking @ c code refrf.c (and suspect classrf.c called do.trace
when it's classification problem) , following 'jprint' flag received do.trace
-flag in surrounding r code, see:
/* print header running output */ if (*jprint <= *ntree) { rprintf(" | out-of-bag "); if (*testdat) rprintf("| test set "); rprintf("|\n"); rprintf("tree | mse %%var(y) "); if (*testdat) rprintf("| mse %%var(y) "); rprintf("|\n"); }
and:
/* print running output. */ if ((j + 1) % *jprint == 0) { rprintf("%4d |", j + 1); rprintf(" %8.4g %8.2f ", errb, 100 * errb / vary); if(*labelts == 1) rprintf("| %8.4g %8.2f ", errts, 100.0 * errts / varyts); rprintf("|\n"); } mse[j] = errb; if (*labelts) msets[j] = errts;
it should not particularly difficult trim code point emitting hundredth tree notification in form desire.
Comments
Post a Comment