Error Code in visTree Package

Hi All,

I wondered if anyone could help me with a problem I've encountered with the visTree package in R, please? https://arxiv.org/pdf/2103.04139.pdf

Essentially, I fit the decision tree model (whether CART, conditional inference tree, or otherwise) yet R returns the following error: 'Error in if (node[[node_id]]$split$breaks) { : argument is of length zero'

An example of my code is given here, with a categorical response variable 'Y.'

ct.fit <- ctree(Y ~ ., train, minbucket = 10, mincrit = 0.95, maxdepth = 3)
visTree(ct.fit, interval = TRUE,  color.type = 1, alpha = 0.6,
        text.percentile = 1.2, text.bar = 1.8)

Would appreciate any possible feedback.

Rep

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Hi @nirgrahamuk . I appreciate your feedback, and of course I understand the motivation behind uploading a reproducible example.

However, the visTree package works with the mock data the authors provide. So, when it comes to uploading a reproducible example, it likely wouldn't resolve the particular issue I am having.

My question was more in terms of the error code, and whether this is something would be familiar with on how to fix.

I dont follow your logic.
Why wouldnt your providing an example to us of the issue you are facing, and having us investigate that, not assist you with solving the issue you are facing?

Hi @nirgrahamuk , I understand your point.

But short of uploading my dataset, the problem I am facing wouldn't be replicated by those replicating. Instead, in visTree, there is a mock data set - and the code works on this. So, simply generating some data to show as an example on here, would unlikely lead to the problem being identified.

What are your barriers to uploading your dataset?
If it should be anonymous, you could anonymise the contents.
if its too large, you can attempt to reduce it, whilst ensuring that the end of your process still shows the error on the smaller data.

Its quite possible we will fail to understand what is wrong even after you provide the data, but it definitely increases your odds of getting practical support if you provide a demonstration of your bug.

@nirgrahamuk. Thanks again, I appreciate your feedback. Unfortunately, I don't have permissions to upload the dataset.

Ok, I'm happy to leave it there, but just for the avoidance of misunderstanding I am not requesting that you upload exactly your dataset, only some representative dataset that sufficiently retains the 'essence' of the issue inherent in your true dataset.
Good luck, hope you can find a solution.

I know, I know. I appreciate your feedback, genuinely.

I'll work on potentially renaming some variables/anonymising etc. And I'll re-post.

Thanks

1 Like

Some digging around shows an attempt by a user back in 2019 to raise this issue to the attention of the package creator.
error running example · Issue #1 · AshwiniKV/visTree (github.com)

It doesn't appear to have been addressed and the package has not had any updates in a long time, so it could simply be that the package is not fit for purpose. We might speculate that partykit ctree used to represent its data one way, which the original visTree relied upon, and this changed in the interim ? pure speculation on my part

Hi @nirgrahamuk

Thanks for your confirmation here. I'd seen the reported error too, but I wasn't sure if it was merely user error for us both.

What threw me off is that they've published a manuscript in March 2021 with identical code, and it kinda had me doubting myself.

Nevertheless, I've emailed the author regarding the problem. Thanks again for your feedback :slight_smile:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.