Improve the speed

#1 can we improve the speed of a predicting new data using a Random Forest Model in R language


This paper on the ranger package, ranger: A Fast Implementation of Random Forests for High Dimensional Data in C++ and R, gives a breakdown of speed depending on various factors. See the SO thread below for some more suggestions:


Hello Mara,

I have gone through this link what you have post but I can't resolve my issue.

Now also it is taking time to predict the output. I am using random forest to do it.

Thanks in advance.


It's hard to give a recommendation on this as an abstraction, here.

Could you please turn this into a self-contained reprex (short for reproducible example) with some dummy data so we can see what packages you're using, etc.?


If you've never heard of a reprex before, you might want to start by reading the help page. The reprex dos and don'ts are also useful.

What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "")

For pointers specific to the community site, check out the reprex FAQ, linked to below.


Hi Mara,


As a note, it is extremely hard to help debug code and/or error messages when screenshots are posted. Posting screenshots, instead of actual code/error messages, is likely to decrease your chances of getting the help you are looking for in general. Instead of posting a screenshot, please copy and paste the code and error message and format the pasted code/error messages as shown below.

Put code that is inline (such as a function name, like mutate or filter ) inside of backticks ( mutate ) and chunks of code (including error messages and code copied from the console) can be put between sets of three backticks:

example <- foo %>%
  filter(a == 1)

This process can be done automatically by highlighting your code, either inline or in a chunk, and clicking the </> button on the toolbar of the reply window!

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code