Questions tagged [party]

Questions related to the R packages party and partykit for recursive partitioning

The R packages party and its successor partykit provide a toolbox for recursive partitioning for a variety of regression models. See the manual and vignettes for more details.

240 questions
0
votes
1 answer

How to get the OOB confusion matrix from `party::cforest()`?

The randomForest() function in the randomForest package very helpfully provides the confusion matrix based on out-of-bag prediction in classification. The cforest() function in the party package does not seem to provide this information. Searching…
Stephan Kolassa
  • 7,953
  • 2
  • 28
  • 48
0
votes
1 answer

J48 partykit access flat list

I would like to access individual nodes in the flat list representation of the party object. That is, I would like to get a node, its split and kids and any other properties. I am new to partykit (just started exploring) so not sure what I am doing…
Krrr
  • 452
  • 1
  • 3
  • 15
0
votes
1 answer

Changing labels in Partykit

In the partykit package, I want to round and format the numeric labels on the edges. How do I do this? For example, below, I'd like to be able to convert <11897.65 to <11,898. Rounding to 0 digits after the decimal place and inserting a comma…
dal233
  • 80
  • 1
  • 6
0
votes
1 answer

observation weights in party mob package

I want to include observation weights in the party package mob() function but get the following error message: m2 <- mob(ab_any ~ rdt_result | pfpr + peak2offpeak + urb_rur + region + fac6type + fac4owner + staff_doctor + supervision_lastvisit +…
emilywj
  • 3
  • 2
0
votes
1 answer

R update ctree (package party) features factors levels

I am trying to make sure that all my features of type factors are represented fully (in terms of all possible factor levels) both in my tree object and in my test set for prediction. for (j in 1:length(predictors)){ if (is.factor(Test[,j])){ …
user3424107
  • 117
  • 1
  • 5
0
votes
2 answers

Understanding partykit graph out of j48 in R

I've made an analysis of a dataset i have consisting on 266 istances and about 100 indicators on that using j48 tree in R. I'm not the most skilled in machine learning, anyway i managed to get the j48 tree in both Weka and R. In the latter i found…
Ciochi
  • 43
  • 7
0
votes
1 answer

How to get the kids of a txt tree in partykit format

If you run the following: library(RWeka) data(iris) res = J48(Species ~., data = iris) you will get the following tree: R> res J48 pruned tree ------------------ Petal.Width <= 0.6: setosa (50.0) Petal.Width > 0.6 | Petal.Width <= 1.7 | | …
Avi
  • 2,247
  • 4
  • 30
  • 52
0
votes
1 answer

How to do decision trees in R?

I usually do decissions trees in SPSS to get targets from a DDBB, I did a bit of research and found that there are three packages: tree, party and rpart that are available for R, but which is better for that task? Thanks!
JJ1603
  • 586
  • 1
  • 7
  • 16
0
votes
1 answer

Why do different machine learning methods give the same variable importance, in caret?

I am comparing different machine learning methods using caret, but though the methods are very different, I am getting identical variable contributions. vNNet, ctree, enet, knn, M5, pcr, ridge, svmRadial give the same variable contributions. Some of…
Isaiah
  • 53
  • 7
0
votes
1 answer

How to find the the deviance of an as.party object converted from rpart tree in R?

I created a tree in R. rp <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis) ## coerce to `constparty' rp.party <- as.party(rp) Now, I want to find the deviance of the rp.party object. Is there a way to do so without going to the rp…
0
votes
1 answer

S4 Object Error when Trying to Access Tree

I get this error: > mod1 <- ctree(Age ~ Kyphosis, data = kyphosis) > tree.size(mod1@tree) Error in tree.size(mod1@tree) : trying to get slot "tree" from an object (class "constparty") that is not an S4 object Here, tree.size is defined as: >…
goldisfine
  • 4,742
  • 11
  • 59
  • 83
0
votes
2 answers

How to tell if a ctree is just a root node?

Say I fit a model like this: ctree(Age ~ Kyphosis, data = kyphosis, mincriterion = 1) How could I get the number of splits? How could I get whether it were just a root node? EDIT: Packages…
goldisfine
  • 4,742
  • 11
  • 59
  • 83
0
votes
1 answer

Store terminal node split rule of ctree into a dataframe in R

I have a dataset (Node1) which contains 6 brands and on applying ctree(), the same is split into 2 terminal nodes. Node2 contains 4 brands Node3 contains 2 brands. I would like to extract these brands of each terminal node and store them in two…
sourav de
  • 5
  • 3
0
votes
1 answer

Somers's C with ctree() of the R package party

I have seen a few articles around that report Somer's Dxy and the C index (I presume with the somers2() function of e.g., Hmisc) for a conditional inference tree generated with ctree() from the R package party. However, I can't seem to find any…
Jeroen Claes
  • 77
  • 1
  • 7
0
votes
1 answer

In the as.party function how can I clarify which are the indices for the different nodes?

After creating my CART with rpart I proceed to convert it to a party object with the as.party function from the partykit package. The subsecuent error appears: as.party(tree.hunterpb1) Error in partysplit(varid = which(rownames(obj$split)[j] ==…
Panchito
  • 337
  • 1
  • 3
  • 12
1 2 3
15
16