title: Random Forest feature importance per value of a column in Python
body: <p>I currently have a dataset with loads of neighbourhoods (samples). There is also one column called 'municipality' which has the name of the municipality to which the neighbourhood belongs. I made a random forest regressor to predict energy consumption in the Netherlands based on many features (of course the column 'municipality' was not used as a feature and it is not a class).</p>
  <p>Sklearn has a feature importance function, but this is for the whole training dataset. I was wondering if it is possible to see per municipality which features were most important there to training the model. I want to see if I can find any spatial differences between feature importances of various municipalities.</p>
  <p>First I thought, maybe I can see for each sample in the training data which features were most important and then sum up all the samples (neighbourhoods) from the same municipality. But I can’t find anything like this on google.</p>
  <p>Hope someone can help.</p>
  <p>Thanks!</p>