apply_impacts(baseline, multiplicative_impacts, additive_impacts)
Apply the impacts on top of the basline to get yhat.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
baseline |
Tensor
|
The baseline impact. This will be the starting point where impacts are applied on. |
required |
multiplicative_impacts |
list[Tensor]
|
These impacts scales the baseline multiplicatively (larger effect). |
required |
additive_impacts |
list[Tensor]
|
These impacts, increase the baseline additively (smaller effect). |
required |
Returns:
Type | Description |
---|---|
Tensor
|
tf.Tensor: The yhat after applying all the impacts on the baseline. |
Source code in wt_ml/layers/impact_utils.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
apply_inverse_impacts(y, multiplicative_impacts, additive_impacts)
Remove the impacts from y
to get the baseline back.
baseline = (yhat - Σ(additive effects)) / ∏(multiplicative effects)
Here its inverse impacts, i.e.,
inverse multiplicative effect = 1/multiplicative effect inverse additive effect = -1 * additive effect
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
Tensor
|
The |
required |
multiplicative_impacts |
list[Tensor]
|
Multiplicative impacts, are scaled down (larger effect). |
required |
additive_impacts |
list[Tensor]
|
Additive impacts, are subtracted off the |
required |
Returns:
Type | Description |
---|---|
Tensor
|
tf.Tensor: The baseline after all the impacts are removed from |
Source code in wt_ml/layers/impact_utils.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|