Git Product home page Git Product logo

reprtree's People

Contributors

albertkuo avatar munoztd0 avatar webbedfeet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

reprtree's Issues

plotting bug

Labels are plotted as if plot.tree(..., type='uniform') is not in effect.

Using with Sklearn and Python

I'm attempting to use this for the random forests I've generated using the sklearn package in python, and my code runs fine in R using repl_python(), but when I get to the step of creating the tree (repr <- ReprTree(py$mod, py$data1)) it stays that it can't be run due to "Error in UseMethod("predict2"). Full error below:

Error in UseMethod("predict2") :
no applicable method for 'predict2' applied to an object of class "c('sklearn.ensemble._forest.RandomForestClassifier', 'sklearn.ensemble._forest.ForestClassifier', 'sklearn.base.ClassifierMixin', 'sklearn.ensemble._forest.BaseForest', 'sklearn.base.MultiOutputMixin', 'sklearn.ensemble._base.BaseEnsemble', 'sklearn.base.MetaEstimatorMixin', 'sklearn.base.BaseEstimator', 'python.builtin.object')"

Has anyone dealt with this before, and if so, is there a way around it?

reprtree with caret

hi, i've seen people also posting similar issue that i get when trying to use the package to plot random forest results from the caret fit. Any way around it? Here is the error I am getting:

zz <- getTree(rf.best$finalModel, k=1, labelVar=TRUE)
realtree <- reprtree:::as.tree(zz, rf.best$finalModel)
>> Error in data.frame(var = fr$var, splits = as.character(gTree[, "split point"]),  : 
  arguments imply differing number of rows: 117, 0

Only reprtree::ReprTree published

No other function is available to R. e.g.

reprtree::plot.getTree(mdl_rf$finalModel)
Error: 'plot.getTree' is not an exported object from 'namespace:reprtree'

I'm using Microsoft Open R 3.4.0 and RStudio 1.0.153 on OS X Sierra 10.12.6.

Thanks

Impossible to plot the tree

Hello !

I tried to use the function reprtree:::plot.getTree(my_model) but it is not working and I have the following message:
"Error in row.names<-.data.frame(*tmp*, value = strtoi(x, 2)) :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': "

I tried to display my trees with the following lines of code:
rf11_100<-randomForest(Bid~., data=df11, ntree=100, proximity=TRUE)
reprtree:::plot.getTree(rf11_100,3,labelVar=TRUE)

(3 is just to get the display of the tree number 3).

Let me know if you need anything else.

Thanks for your help !

Visign

Problem in finding tree based on causalForest (from casualTree package) function

Hello,

I used the "casualForest" function from "causalTree" package, once I want to find the best tree by using "reprtree" function, I got the following error.

I really appreciate any help.

dataset:
N observation:9000
outcome variable: categorical (0,1)
W=categorical


cf <- causalForest(formula=fmla, data=forestX, treatment=forestX$W,
split.Rule="CT", split.Honest=T, split.Bucket=F, bucketNum = 5,
bucketMax = 100, cv.option="CT", cv.Honest=T, minsize = 2L,
split.alpha = 0.5, cv.alpha = 0.5,
sample.size.total = floor(nrow(forestX) / 2), sample.size.train.frac = .5,
mtry = ceiling(ncol(forestX)/3), nodesize = 100, num.trees=10,
ncolx=length(predictorsNames),ncov_sample=4)


ReprTree(cf,forestX,metric="d2")
[1] "Constructing distance matrix..."
Error in UseMethod("predict2") :
no applicable method for 'predict2' applied to an object of class "causalForest"

as.tree fails

Reproducible example:

library(reprtree)
library(randomForest)
data(spam, package="kernlab")

rf <- randomForest(type ~. , data = spam, ntree = 10)
as.tree(getTree(rf, 1, labelVar = T), rf)

Produces:

Error in match.fun(FUN) : object 'factor.repr' not found

Error in library("reprtree") : there is no package called ‘reprtree’

The comment above is the error message I receive in R v 3.5.1 when I attempt to install the reprtree package using the code below:

`options(repos='http://cran.rstudio.org')
have.packages <- installed.packages()
cran.packages <- c('devtools','plotrix','randomForest','tree')
to.install <- setdiff(cran.packages, have.packages[,1])
if(length(to.install)>0) install.packages(to.install)

library(devtools)
if(!('reprtree' %in% installed.packages())){
install_github('araastat','reprtree')
}
for(p in c(cran.packages, 'reprtree')) eval(substitute(library(pkg), list(pkg=p)))`

Any thoughts on how to fix this?

RF with one tree fails

Reproducible example:

library(reprtree)
library(randomForest)
data(spam, package="kernlab")

rf <- randomForest(type ~. , data = spam, ntree = 1)
reptr <- ReprTree(rf, spam, metric = "d2")

Produces:

[1] "Constructing distance matrix..."
Error in x[l, ] : subscript out of bounds

Solution: something like:
if ntrees = 1, then representative tree is that tree

node IDs in plot

Great package, thx
Could we add node IDs to the plot ?

Thanks!
Markus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.