public class ContributionComposer
extends java.lang.Object
| Constructor and Description |
|---|
ContributionComposer() |
| Modifier and Type | Method and Description |
|---|---|
int |
checkAndAdjustInput(int n,
int len) |
int[] |
composeContributions(int[] contribNameIds,
float[] contribs,
int topN,
int bottomN,
boolean compareAbs)
Sort #contribNameIds according to #contribs values and compose desired output with correct #topN, #bottomN fields
|
public final int[] composeContributions(int[] contribNameIds,
float[] contribs,
int topN,
int bottomN,
boolean compareAbs)
contribNameIds - Contribution corresponding feature idscontribs - Raw contribution valuestopN - Return only #topN highest #contribNameIds + bias.
If topN<0 then sort all SHAP values in descending order
If topN<0 && bottomN<0 then sort all SHAP values in descending orderbottomN - Return only #bottomN lowest #contribNameIds + bias
If topN and bottomN are defined together then return array of #topN + #bottomN + bias
If bottomN<0 then sort all SHAP values in ascending order
If topN<0 && bottomN<0 then sort all SHAP values in descending ordercompareAbs - True to compare absolute values of #contribspublic int checkAndAdjustInput(int n,
int len)