1

I have the following weighted Jaccard metric:

$D_{WJ}(X_{i},X_{j})=1- \cfrac{\Sigma_{k} min(X_{ik},X_{jk})}{\Sigma_{k} max(X_{ik},X_{jk})} ; X_{i},X_{j}\in R^{n}$

I want to find the derivative of $D_{WJ}$ with respect to the components in order to perform some sort of gradient descent algorithm.

I can't seem to find a closed expression for the derivative due to the $min$/$max$.

reasoning: I'm trying to perform and iterative procedure that is dependent on the $D_{WJ}$ so I need to come with a step progress in the desired direction prior to implementing it

would appreciate some help.

Jean Marie
  • 88,997
David
  • 270
  • 1
    What do you mean by fitting a matrix to a line? –  Sep 04 '19 at 10:52
  • @Rahul I have a matrix that each column is a point in a $N$ dimensional space, ant I want to fit it to a linear line; Is that clearer? – David Sep 04 '19 at 11:12
  • I have asked a question some months ago about a form related to Jaccard index (https://math.stackexchange.com/q/3173596) whose positive definiteness could hopefuly be used for defining an optimization process. – Jean Marie Sep 04 '19 at 23:25
  • 1
    $$\frac{\mathrm d}{\mathrm dx} \min(x,y) = \begin{cases}1 & \text{if $x < y$,}\0 & \text{otherwise}\end{cases}$$ and similarly for the second argument and the case of $\max$. That should make it possible to calculate the full derivative. –  Sep 08 '19 at 10:51
  • @Rahul I wasn't sure that this is indeed the derivative, thanks; and applying Quotient Rule on the expression. If you'd like to write it as an answer for me to approve it; Would appreciate an upvote (to avoid blocking of the ability to ask questions) – David Sep 08 '19 at 12:10

1 Answers1

1

$$\begin{align} & \min(x,y) \begin{cases}x & \text{if $x<y$,} \\ y & \text{otherwise}\end{cases} \\ \implies \quad & \frac{\mathrm d}{\mathrm dx}\min(x,y) =\begin{cases}1 & \text{if $x<y$,} \\ 0 & \text{otherwise,}\end{cases} \end{align}$$ and similarly for the second argument and for the case of $\max$. Then you can apply the quotient rule / chain rule / etc. to calculate the full derivative.