Tak Kaneko
2001-May-07 17:04 UTC
[R] "tree": Extracting deviance & Gaussian model of the node?
Hi I'm trying to use the "tree" package in R to predict intonation for a speech synthesiser and when I feed the feature vector into the tree, I want to get the predicted value and the deviance associated with that node. Q.1 --- I was hoping that the following command will return a tree object of the predicted values, but I get the following error: ------------------------------------------------------------> test.tr <- predict.tree(pr,test.data,type="tree")Error in as.list(X) : Object "response.names" not found where: pr = A tree was grown using the training data and then pruned back to where the deviance was minimised when a separate test data set was used. "pr" is this pruned tree. test.data = test data with the features and response ------------------------------------------------------------- How would I be able to access the prediction and the deviance? Would this work if the data was a feature vector with no responses? (as would be the case when it comes to predicting the real thing). Q.2 --- Assuming that the distribution of the data at each node is Gaussian, I'd like to model each node as a gaussian probability density function with a mean at the predicted value and variance, which is presumably related to the deviance... I've found out the definition for the deviance from the S-plus manual but it's not yet clear to me. So how could I deduce the variance of a value predicted by "tree"? Thanks and I'd be grateful if you could also reply to my address above (tk229 at cam.ac.uk). Tak Kaneko -------------------------------------------------------- Mobile: 07866 581 806 Cambridge Tel: 01223 711 160 Permanent e-mail: tkaneko at iee.org Home: Tel (01494) 680 230 11 Oldbury Grove, Beaconsfield, Bucks HP9 2AJ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Is there a limit on how many features can be used to train a CART tree? I built some trees using one set of features, which didn't perform very well so I added some more (better) features but none of these got used in training the tree. When I specified the tree to use the new features and some of the old features, it finally used the new features and the resulting trees performed well. There are two alternative explanations I can think of: 1. There is only a maximum number of features that "tree" can utilise. 2. In the first few branches, the older features are used because they reduce the deviance much more but actually on the long run, it's better to use the new features. It's probably bad practice just throwing lots of features any way but I'd be grateful for some explanations! tak -------------------------------------------------------- Mobile: 07866 581 806 Cambridge Tel: 01223 711 160 Permanent e-mail: tkaneko at iee.org Home: Tel (01494) 680 230 11 Oldbury Grove, Beaconsfield, Bucks HP9 2AJ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Apparently Analagous Threads
- lme: null deviance, deviance due to the random effects, residual deviance
- Sum of the deviance explained by each term in a gam model does not equal to the deviance explained by the full model.
- svydesign syntax and deviance!
- rpart vs. tree and deviance calculations
- Residual deviance in glm