How PowerShap works
mainPowerShap selects features by comparing their impact on model predictions against the impact of a known random feature.
- Iteration: The algorithm trains multiple models on different data subsets. In each iteration, a random uniform feature is added to the dataset.
- Shapley Calculation: For each model, it calculates the absolute Shapley values. For multi-output or multi-class tasks, it uses the maximum across outputs. These values are averaged per feature to represent impact.
- Statistical Testing: After all iterations, each feature's impact array is compared to the random feature's impact array using a percentile formula to generate a p-value.
- Selection: Features with a p-value below a specific threshold (default is
0.01) are retained.
Automatic Mode
To avoid manual hyperparameter tuning for the number of iterations and the threshold, PowerShap uses an automatic mode by default:
- It starts with 10 iterations.
- It calculates the effect size and statistical power (using a student-t power test) for each feature.
- It determines the required iterations to meet a predefined power requirement (default is
0.99, representing a false positive probability of0.01). - It continues executing additional iterations until the required power is achieved.