From gavin.simpson at ucl.ac.uk  Thu Aug 26 09:54:48 2010
From: gavin.simpson at ucl.ac.uk (Gavin Simpson)
Date: Thu, 26 Aug 2010 08:54:48 +0100
Subject: [Rd] Decision tree and factor variables
In-Reply-To: <1282806363379-2339234.post@n4.nabble.com>
References: <1282806363379-2339234.post@n4.nabble.com>
Message-ID: <1282809288.2302.80.camel@desktop.localdomain>

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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



[Rd] Decision tree and factor variables
Gavin Simpson