[Python] How do I stop curve fit from overfitting one point?

Discussão em 'Python' iniciado por Stack, Janeiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to fit the function C * np.sqrt(a - x) + D (a is a number, not a parameter) to some data, and it’s really overfitting one point.

    I’ve plotted it on Desmos based on the popt values python is giving me and the fit looks great within uncertainty. But when I actually plot the fit, it’s way above most of my data points but it’s coinciding exactly with one point. I think there’s a way to change the weight, but that’s a ton of extra lines of code from what I’ve seen. Does curve fit have anything built in? All of my data points have the same uncertainty so I don’t think I can use sigma = weights.

    Continue reading...

Compartilhe esta Página