PySR icon indicating copy to clipboard operation
PySR copied to clipboard

[Feature] My wild idea

Open richinex opened this issue 2 years ago • 0 comments

I have been thinking about this my idea, might sound stupid:

I have a circuit (called randles circuit), whose impedance is defined by the function:

def randles(p, f):
    s = 1j * 2*np.pi*f
    Rs = p[0]
    Cdl = p[1]
    Rct = p[2]
    Wct=p[3]
    Zct = Rct + Wct
    Ydl = s*Cdl + 1/Zct
    Z=Rs + 1/Ydl
    return Z

p represents the parameters, f is the frequencies, 1j represents the complex number so the output Z of the randles function is complex number in C^n but could be written also in R^2n by concatenating the real and the imaginary parts.

Then I also have some experimental data Zexpt which is also complex and the frequencies f which is real. My loss function is the weighted nonlinear least squares where the weights can be the inverse of the squared absolute value of the impedance

Now I was wondering if it is possible to use symbolic regression to approach this type of problem in such a way that I search the space of combinations of Rs, Cdl, Rct, Wct to fit any arbitrary impedance data or maybe obtain a set of polynomials in f that approximate the impedance. I tried to do the latter but the results were not encouraging.

Thanks


model = PySRRegressor(
    niterations=40,
    binary_operators=["plus", "mult", "-", "/"],
    unary_operators=["inv(x) = 1/x",],
    model_selection="accuracy",
    populations=300,
    variable_names = list(names),
    # loss="loss(x, y) = sum(1/abs(y)^2 * (x-y)^2)",

)

richinex avatar Jul 29 '22 10:07 richinex