I have a function similar to square error. It goes till n (n ~ 1000)
f(s) = (d1 - sd'1)**2 + (d2 - sd'2)**2 + .... + (dn - sd'n)**2
I have 2 lists
d = [0.0322, 0.245, 0.85 ..... n]
d' = [56, 200, 340 ..... n]
I want to calculate the global minima of this function(find s ?). I know I can try scipy optimizer(http://scipy-lectures.org/intro/scipy/auto_examples/plot_optimize_example2.html) to calculate this but I am not able to form the function like they did on their documentation like below.
def f(x):
return x**2 + 10*np.sin(x)
How do I can form this f(x) based on my function? If there is any more optimize way to do this please mention it.
You can use this code:
Output: