How can I solve for $c$ while having in the denominators for a sum of fractions with index-variables?

46 Views Asked by At

I would like to fit functions of the form

$$f(n) = \frac{a}{n^s + c} + b$$

to data points $(x_i, y_i)$ so that the mean squared error (MSE) is minimized. To find optimal $a, b, c, s > 0$ I wanted to calculate the partial derivatives, set it to 0 and solve for the variable I derived for. This worked fine for $a$ and $b$, but I'm stuck with the following term for $c$:

$$0 \overset{!}{=} \sum_{i=1}^{|I|} \frac{-a}{(x_i^s + c)^3} + \frac{y_i - b}{(x_i^s+c)^2}$$

How can I solve such a term for $c$?

1

There are 1 best solutions below

2
On

Considering the function : $$y(x)=\frac{a}{x^s+c}+b$$ This function is a solution of the integral equation : $$xy=\alpha\int y^2dx+\beta\int ydx+\gamma x\quad\text{where}\quad \begin{cases}\alpha=\frac{sc}{a}\\ \beta=1-s+2b\frac{sc}{a} \\ \gamma=sb+\frac{scb^2}{a} \end{cases}$$ $$x_ky_k-x_1y_1\simeq\alpha\int_{x_1}^{x_k} y^2dx+\beta\int_{x_1}^{x_k} ydx+\gamma (x_k-x_1)$$ The values of the two integrals are directly computed from the experimental data thanks to numerical integration. A linear regression leads to approximates values of $\alpha$ , $\beta$ , $\gamma$. Further calculus leads to approximates of $a$ , $b$ , $c$ , $s$.

The overall result depends on the accuracy of the numerical integrations. That is why it is important to know what is the distribution of the $x_k$ and $y_k$ (range, nombre of points, regularity or not of the intervals) and also the extend of scatter on the $y_k$. The robustness of the method of regression cannot be evaluated without knowing the kind of experimental data to be treated.

For example, if we set arbitrary values, for example as proposed in the comments : $$a=2\quad;\quad b=0.3 \quad;\quad c=5\quad;\quad s=2$$ and generate some data with various scatter, some results are shown below.

If the scatter is too high, the computed parameters become no longer real and the result isn't valid.

enter image description here

In the more realistic case with the data published in https://github.com/MartinThoma/vcf/blob/master/vcf-data/cnn32-32-64-64-1024-1024-relu-30000-train.csv

enter image description here

The fitting isn't good for the points with low values of $x$. This is due to the too small number of points on this range : the values of $y$ are not well distributed. The numerical integration cannot be accurate enough.

Note : With the method of regression with integral equation, the criteria of fitting is not the same as with the least mean square method. If you definitively want the least mean square, you have to use a non-linear regression method with guessed initial values of parameters and iterative process. The values of parameters obtained above can be used as very good initial values. With mean least squares non-linear regression method, in case of the given data, one can expect a better fit in the range of $x$ large, but worse in the range of $x$ small.

enter image description here

The regression with integral equation leads to a better fit in the range of small $x$. On the other hand, the MSE is higher.

COMPUTATION PROCESS :

enter image description here