[Rd] Decision tree and factor variables

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Aug 26 09:54:48 CEST 2010


On Thu, 2010-08-26 at 00:06 -0700, clusty wrote:
> Hello,
> 
> I'm building a decision tree in R with the rpart package. Modeling is
> fine. But when it comes to scoring, I have the following issue:
> 
> factor 'cust_language' has new level(s) OT
> 
> I think this comes from the fact that when learning, the DT doesn't
> see all the possible value of the factor variable cust_language. When
> scoring, new values comes and I get this error. However, it should not
> be a problem to have new values for a factor variable when scoring
> with decision tree.
> 
> Any idea on how I should handle the problem?
> Thanks. 

Wrong list. R-Devel is for discussion pertaining to development of and
with R. You need R-Help.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-devel mailing list