Q:

Parameter estimates for generic data for any function

I have a function. For example:
def g(w,d,e):
    s = w-1.
    s1 = s**d+2.    
    s2 = 42. + s1*e**(1/2)
    return s2

Lets data = np.array([1,2,3,4,5]) it is s2. But I don't know d and e.
How I can estimate them?  Errors? 
It's called method "fit" in scipy.stats for distribution. What is in this method under the hood? MLE ? Sampling? Function g is my distribution function...

A:

According to your question, your function could be written as
def g(w,d,e):
    return 42. + ((w-1)**d+2)*e**(1/2)

so what you seem to need instead of a fitting procedure that minimizes the squared error between predicted values and observed values is a non-linear equation solver. Scipy provides the root function that should help you do what you want. For instance, you could iterate over the data and compute the corresponding parameter values for each data item
import numpy as np
import scipy.optimize.root as root
sol = []
data = np.array([1,2,3,4,5])
for d in data:
    f = lambda x: g(x[0],x[1],x[2])-d
    sol.append(root(f,x0).x)

Function parameter fits need you to supply an array of independent variable values (x) and the observed dependent values (y). During the fit, you usually try to find the parameters that minimize the difference between the prediction and the observation.

