search for: rfobj

Displaying 1 result from an estimated 1 matches for "rfobj".

Did you mean: fobj
2008 Feb 04
0
SOLVED: use classificators learned in R in "real-life", e.g. C
...oser look at the representations of rpart or randomForest, I came to a much simpler and straight-forward solution: with only a couple of lines, the corresponding c-code for a tree can be emitted. e.g. for randomForest: ## generate C code from rforests. generate code for tree k gen_code=function(rfobj,k) { tree=getTree(rfobj,k,labelVar=TRUE); count=0; loc.env=environment(); visit=function(idx) { assign('count',count+1,env=loc.env); if (tree[idx,'status']==-1) cat(sprintf("RETURN(%s)\n",tree[idx,'prediction'])) else { cat...