Questions tagged [r-ranger]

69 questions
1
vote
2 answers

how to get the same prediction (probability and class) in a random forest

I'm fitting two models with the ranger package and the same seed. The first one predicts the class and the second one returns the probability matrix, my goal is to reach the same result, but I differ in 4 registers. Someone knows the solution. I'm…
Rafael Díaz
  • 2,134
  • 2
  • 16
  • 32
1
vote
0 answers

Different predictions for the same test set data having different levels in the factor variables in R (Ranger)

I have a training data trainhaving distance and dest_zip_code as predictor variables to predict delivery_days. I am using ranger RF model to create the 'Quantile RF regression' model object. Please note that the dest_zip_code levels in the…
Murali
  • 154
  • 1
  • 12
1
vote
1 answer

Construction of confusion matrix

I have a question concerning the construction of confusion matrix from the below link: Ranger Predicted Class Probability of each row in a data frame If I have the following code for example (as explained by the answer in the…
Ray
  • 321
  • 2
  • 12
1
vote
1 answer

R ranger confusion.matrix is larger than supposed when using expand.grid and purrr::pmap

Sorry for all the purrr related questions today, still trying to figure out how to make efficient use of it. So with some help from SO I managed to get random forest ranger model running based on input values coming from a data.frame. This is…
crazysantaclaus
  • 613
  • 5
  • 19
1
vote
1 answer

Ranger Predicted Class Probability of each row in a data frame

With regard to this link Predicted probabilities in R ranger package, I have a question. Imagine I have a mixed data frame, df (comprising of factor and numeric variables) and I want to do classification using ranger. I am splitting this data frame…
Ray
  • 321
  • 2
  • 12
0
votes
0 answers

Why are ranger classification forest probability predictions exactly 0.5 when using low `sample.fraction` on particular data?

Context Using the ranger package in R, I am training a probability forest on a binary response. Problem Summary For particular combinations of data size and sample.fraction, all predicted probability values are precisely 0.5. Small tweaks to either…
0
votes
1 answer

'classif.ranger' not found in DictionaryLearner

I am trying to implement the tuning space 'classif.ranger.rbv1' from mlr3tuningspaces However, I am getting an error for the learner that the 'classif.ranger' is not found in the DictionaryLearner I have tried two methods, shown below tuning_space…
0
votes
1 answer

Recursive feature elimination (rfe) with ranger random forest in R

I'm trying to run recursive feature elimination with a random forest from the ranger package with permutation importance because I have a large dataset with a lot of correlated variables. I'm struggling to set up the control function (or at least…
Jade131621
  • 316
  • 1
  • 13
0
votes
1 answer

R: Boruta algorithm can't find function getimp

I want to run a Boruta algorithm that uses the importance of a random forest made with the ranger function. However, when using the code below, I get the error "Error in getImp(cbind(x[, decReg != "Rejected"], xSha), y, ...): could not find function…
Joep_S
  • 481
  • 4
  • 22
0
votes
1 answer

Cross Validation on R Ranger Library

Hello I have the following ranger model: X <- train_df[, -1] y <- train_df$Price rf_model <- ranger(Price ~ ., data = train_df, mtry = 11 ,splitrule = "extratrees" ,min.node.size = 1, num.trees =100) I am trying to accomplish two things, Give me…
Cindy Burker
  • 117
  • 9
0
votes
0 answers

Get the importance of predictors BY CLASS with train() with "ranger" as method

I have trained the following model through the train() function and using the "ranger" method. In my case, we are dealing with a very small dataset (about 100 samples) and where the predictors are 84 and with a binary outcome (0 or 1). The class to…
0
votes
0 answers

Why does ranger predict give different numbers when re-applied to training data?

I am very new to machine learning. I am trying to explore fitting random forests with the ranger library in R. My dependent variable is continuous - so it would be a regression tree (and not just classification). Upon trying out the functions, I…
Jhonny
  • 145
  • 8
0
votes
1 answer

How to obtain tree-level, out-of-bag predictions from a random forest using the ranger package?

For each observation in a data frame that trains a random forest model, there is a set of trees (of size ~1/3 of the total number of forest trees) for which that observation was not in-bag. I would like to get a measure of spread of such out-of-bag,…
0
votes
1 answer

Assigning weights to variables in random forest model in R

I am trying to fit a random forest model using 'ranger' in 'tidymodels', and get an error while assigning weights to predictor variables. In reproducible code below, 'Petal.Length' and 'Petal.Width' from 'iris' dataset are predictor variables, and I…
jaykay
  • 71
  • 7
0
votes
1 answer

Extracting estimates with ranger decision trees

I am getting the error message Error: No tidy method for objects of class ranger when trying to extract the estimates for a regression model built with the ranger package in R. Here is my code: #…