Importance of fields in the dataset in randomforest

0 votes
Hi. I'm using randomforest method to make a prediction of testdata. Is there a way to display the value or order of fields?
Aug 25, 2019 in Data Analytics by anonymous
527 views

1 answer to this question.

0 votes
Use Function importance() which defines the importance or order of fields in a decision tree.

The functions return a data frame with field names, accuracy for each prediction and accuracy is displayed.

Ex: Importance(randomforest_model).

mtcars.rf <- randomForest(mpg ~ ., data=mtcars)
> importance(mtcars.rf)
       %IncMSE IncNodePurity
cyl  17.311478     180.55303
disp 20.064044     250.82581
hp   17.506333     187.55177
drat  7.041252      61.64077
wt   18.566081     248.37960
qsec  3.518307      32.91833
vs    5.418713      26.88210
am    5.296174      17.83260
gear  3.807433      19.50622
carb  7.725077      28.68420
answered Aug 25, 2019 by anonymous
• 33,030 points

Related Questions In Data Analytics

+1 vote
1 answer

Is it possible to change the column names of the dataset that I'm using in R?

That is definitely possible in R. You ...READ MORE

answered Dec 17, 2018 in Data Analytics by Anisha

edited Dec 17, 2018 1,716 views
+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
1,937 views
+1 vote
2 answers

How to count the number of elements with the values in a vector?

Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
5,019 views
0 votes
1 answer
0 votes
1 answer

different results for Random Forest Regression in R and Python

Random Forests, as others have mentioned, have ...READ MORE

answered Apr 12, 2022 in Machine Learning by Dev
• 6,000 points
1,536 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
1,030 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,180 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,890 views
0 votes
1 answer

How to change the datatype of any field in an external dataset in R?

Hi Anand, Try as below - class(dataset/dataframe$col_name) <- ...READ MORE

answered Jun 28, 2019 in Data Analytics by anonymous
• 33,030 points
764 views
0 votes
1 answer

% of nulls for each column in the dataset - R

Use code as below -  lapply(air,function(x) { length(which(is ...READ MORE

answered Jul 4, 2019 in Data Analytics by anonymous
• 33,030 points
1,128 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