liveBook · Manning

Gini importance

As explained in Build AI Drug Discovery Pipelines

Gini importance is a tree-ensemble feature-importance measure based on the weighted reduction in node impurity attributable to each feature.

Gini importance ranks features in a Random Forest by their weighted contribution to impurity reduction across decision-tree nodes. Each node is weighted by its original training-sample count, and the resulting importances are normalized to sum to 1. section 5.3.2

For CYP3A4 inhibition classification, the measure identifies influential Morgan fingerprint bits, helping connect a trained molecular model to potentially relevant substructures. section 5.3.2

Listing 5.6 Random Forest Gini Importance
bit_indices = np.argsort(rf_clf.feature_importances_)[::-1]
for i in range(10):
  print(f"{i + 1}. Fingerprint Bit {bit_indices[i]} :   {rf_clf.feature_importances_[bit_indices[i]]:.5f}")
# Output ->  1. Fingerprint Bit 1750 : 0.01401
#            2. Fingerprint Bit 1088 : 0.00986
#            3. Fingerprint Bit 1603 : 0.00905
#            4. Fingerprint Bit 1536 : 0.00899
#            5. Fingerprint Bit 875 : 0.00876
#            6. Fingerprint Bit 841 : 0.00729
#            7. Fingerprint Bit 1152 : 0.00718
#            8. Fingerprint Bit 802 : 0.00667
#            9. Fingerprint Bit 781 : 0.00630
#           10. Fingerprint Bit 1873 : 0.00623

Inspect the ten highest-ranked fingerprint bits and their normalized importance values. section 5.3.2

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Explains weighting, normalization, and ranking, but stops short of mapping fingerprint bits to molecular substructures.
Examples
Prints the ten most important fingerprint bits, led by bit 1750 with importance 0.01401.
What it assumes
Uses a trained Random Forest classifier and molecular fingerprint features as inputs.
What you can do after
Apply it via a trained Random Forest’s feature_importances_ attribute to rank model features.
How it connects
Connects Random Forests, decision trees, node impurity, Morgan fingerprints, and CYP3A4 inhibition classification.

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.