Removing unimportant variables before building Random Forest

0 votes

I am using the 'fgl' data-set from the MASS package and building the Random Forest model. 

model1<-randomForest(type ~ .,data=fgl)

Now, I'd want to know can i remove the unimportant variables beforehand so that i can build a better Random Forest algorithm?

Apr 4, 2018 in Data Analytics by BHARANI
• 420 points
2,120 views

1 answer to this question.

0 votes

Build the randomForest model on top of the 'fgl' data-set as usual and then use the importance() function to find the relative importance measure of these variables.

rf<-randomForest(type ~ .,data=fgl)
importance(rf)

This gives you the following result:

 MeanDecreaseGini
RI         23.00797
Na         16.73084
Mg         25.26359
Al         24.97366
Si         13.05597
K          13.86039
Ca         20.30383
Ba         13.24304
Fe          6.80955

Now, you can go ahead and start building the randomForest model by removing the least important variables

answered Apr 4, 2018 by Bharani
• 4,660 points

Related Questions In Data Analytics

0 votes
1 answer

Would time taken to train n-random forest be equal to n x (decision trees)

No, the time to train the random ...READ MORE

answered Aug 7, 2018 in Data Analytics by Abhi
• 3,720 points
784 views
0 votes
1 answer

What is the difference between random forest and decision trees?

The basic difference is that Random Forest ...READ MORE

answered Jul 30, 2018 in Data Analytics by Abhi
• 3,720 points
2,201 views
0 votes
1 answer

R programming: Using Caret package to implement Random Forest

You can check out the official docs ...READ MORE

answered Apr 30, 2019 in Data Analytics by Tyrion anex
• 8,700 points
723 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,227 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
5,912 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,158 views
0 votes
1 answer

Plotting multiple graphs on the same page in R

If you want to plot 4 graphs ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,445 views
0 votes
1 answer

Building Random Forest on a data-set comprising of missing(NA) values

You have two options, either impute the ...READ MORE

answered Apr 3, 2018 in Data Analytics by Bharani
• 4,660 points
1,431 views
+1 vote
2 answers

Finding number of missing values and removing those missing values from a data-frame

To find number of missing values for ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
1,117 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP