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
• 400 points
154 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,550 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 ANMOL
• 3,620 points
19 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 ANMOL
• 3,620 points
271 views
0 votes
1 answer
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,550 points
29 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,550 points
39 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

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

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,550 points
65 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,550 points
29 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 2, 2018 in Data Analytics by Bharani
• 4,550 points
77 views
+1 vote
1 answer

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

This code gives the total number of ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,550 points
19 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.