blogging. thanks. ]]>

I have a question regarding the contribution of individual features in terms of percentages. If I want to get % contribution of each feature on getting the total prediction value, can I just get divide ‘feature contribution’/’prediction’ ?

I understand that there are a few -ve values as well. In that case, my idea was to take abs() of all contributions, add bias, and get the ‘total value’. Then take ‘feature contribution’ and divide by ‘total value’ .

Sample code- from instance[0] and instance[1] example.

prediction, bias, contributions = ti.predict(rf, instances)

temp_arr= np.array(bias[1])

temp_arr= np.append(temp_arr,contributions[1])

sorted(zip(np.around(abs(temp_arr)/np.sum(abs(temp_arr))*100,1), np.append(‘bias’,boston.feature_names)),reverse=True)

I look forward to your thoughts on such an approach, and understanding what could be the pitfalls.

Thanks!

]]>