Derivative of F-measure

142 Views Asked by At

F-measure is defined as the harmonic mean of precision and recall, so $$F= \frac{2PR}{P+R}, \quad \frac{dF}{dR}=2\frac{P^2}{(P+R)^2}, \quad \frac{dF}{dP} = 2\frac{R^2}{(P+R)^2} $$

Suppose there is another variable, $B$ such that $P=f(B)$ and $R=g(B)$. Can we express $\frac{dF}{dB}$ using the chain rule in terms of $\frac{dF}{dP}, \frac{dF}{dR}, \frac{dP}{dB}, \frac{dR}{dB}$?

My alternative is to obtain $F=h(B)$ through substitution and find $\frac{dF}{dB}$ from that equation, but I'm hoping for something simpler. I understand that partial derivatives assume that the other quantities are held constant, and this assumption doesn't hold if we try to directly apply the chain rule as $\frac{dF}{dB} = \frac{dF}{dP} \frac{dP}{dB} $.

2

There are 2 best solutions below

7
On BEST ANSWER

By the chain rule:

$$\frac{dF}{dB}=\frac{\partial F}{\partial P}\frac{dP}{dB}+\frac{\partial F}{\partial R}\frac{dR}{dB}=\frac{\partial F}{\partial P}\frac{dP}{dB}+\frac{\partial F}{\partial R}\left[\frac{dR}{dP}\frac{dP}{dB}\right].$$

where you'll need to know what $R=R(P)$ looks like. By differentiating your equation for $F$ in $P$, and rearranging it for $R$, you should get an answer for $\frac{dR}{dP}$ in terms of $dF/dP,P$ after also solving the original equation for $R$ in terms of $F,P$.

0
On

This is my approach to solving, but I don't know if it is correct or as simple as it can be.

$$\frac{dF}{dB} = \frac{d}{dB} \Big[\frac{2PR}{P + R}\Big] = 2 \frac{(P+R)\frac{d}{dB}\big[PR\big] - PR\frac{d}{dB}\big[P +R\big] }{(P+R)^2} \qquad \text{Quotient Rule} $$ $$ = 2 \frac{(P+R)\big(\frac{dP}{dB}R + \frac{dR}{dB}P\big) -PR(\frac{dP}{dB} + \frac{dR}{dB})}{(P+R)^2} \qquad \text{Product, Addition Rule} $$ $$ = 2 \frac{ \frac{dP}{dB}PR + \frac{dR}{dB}PR + \frac{dR}{dB}P^2 + \frac{dP}{dB}R^2 -PR(\frac{dP}{dB} + \frac{dR}{dB})}{(P + R)^2}$$ $$ = 2 \frac{ PR(\frac{dP}{dB} + \frac{dR}{dB}) + \frac{dR}{dB}P^2 + \frac{dP}{dB}R^2 -PR(\frac{dP}{dB} + \frac{dR}{dB})}{(P + R)^2}$$ $$ = 2 \frac{ \frac{dR}{dB}P^2 + \frac{dP}{dB}R^2 }{(P + R)^2}$$

Which is what you get if you apply the chain rule as stated in the accepted answer.