DALEX icon indicating copy to clipboard operation
DALEX copied to clipboard

Adding partial derivative and partial log-derivative

Open palmierieugenio opened this issue 3 years ago • 3 comments

I think it could useful a function to calculate numerically not just the partial plot of the predictor, like in the function variable_effect_partial_dependency , but also the partial derivative of the predictor for the additive effect:

\begin{equation*}
\frac{\partial f(X)}{\partial X_j}=\lim_{h \to 0} \frac{f(X_j+h| \ X_{-j}) - f(X)}{h} ,
\end{equation*}

and the logarithmic partial derivative for the multiplicative effect:

\begin{equation*}
\frac{\partial log(f(X))}{\partial X_j}=\lim_{h \to 0} \frac{log(f(X_j+h| \ X_{-j})) - log(f(X))}{h} ,
\end{equation*}

It could be possible to calculate it like tha partial response in the variable_effect_partial_dependency function: fixing all other covariates and changing just X_j.

palmierieugenio avatar Oct 24 '20 09:10 palmierieugenio

Hi,

thank you so for your valuable ideas! We will try to implement them.

@pbiecek what do you think about adding derivative_partial type to model_profile and thus to aggregate_profiles in ingredients. IMO it fully complies with the definition of the Model Profile task. We could estimate the partial derivative of the predictor by setting a very dense grid of points to evaluate for standard profiles and then just dividing proper values to get the derivative.

maksymiuks avatar Nov 02 '20 23:11 maksymiuks

Hi,

thank you so for your valuable ideas! We will try to implement them.

@pbiecek what do you think about adding derivative_partial type to model_profile and thus to aggregate_profiles in ingredients. IMO it fully complies with the definition of the Model Profile task. We could estimate the partial derivative of the predictor by setting a very dense grid of points to evaluate for standard profiles and then just dividing proper values to get the derivative.

If you make some progress, please reply and tell me how you called the function (or if it was a failure and it doesn't work), I am curious to test it and understand if it gives interesting results.

palmierieugenio avatar Jan 25 '21 11:01 palmierieugenio

@pbiecek are you continuing on this?

maksymiuks avatar Apr 12 '21 22:04 maksymiuks