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 24, 2019 in Data Analytics by anonymous
35 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
• 32,460 points

Related Questions In Data Analytics

0 votes
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 80 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
174 views
0 votes
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
• 32,460 points
228 views
0 votes
1 answer
0 votes
1 answer

Big Data transformations with R

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

answered Dec 17, 2017 in Data Analytics by Sudhir
• 1,610 points
124 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,560 points
162 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,560 points
1,202 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,560 points
208 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 27, 2019 in Data Analytics by anonymous
• 32,460 points
54 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
• 32,460 points
70 views