Created
February 13, 2020 16:34
-
-
Save BenHeubl/ac732c97a074875e62d8b7d017d67dc8 to your computer and use it in GitHub Desktop.
tut15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ggplotting our featuer importance: | |
Feature_importance <- importance(model_base) | |
var_Importance <- data.frame(Variables = row.names(Feature_importance), | |
Importance = round(importance[ ,'MeanDecreaseGini'],2)) | |
#Create ranks for variable based on importance | |
Rank_Importance <- var_Importance %>% | |
mutate(Rank = paste0('#',dense_rank(desc(Importance)))) | |
#Relative importance of our varaibles | |
ggplot(Rank_Importance, aes(x = reorder(Variables, Importance), | |
y = Importance, fill = Importance)) + geom_bar(stat='identity') + | |
geom_text(aes(x = Variables, y = 0.5, label = Rank), hjust=0, vjust=0.55, size = 4, colour = 'white') + | |
labs(x = 'Variables') + | |
coord_flip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment