Data fitting is to fit a line through a data set i.e. a series of data points.
Questions tagged [data-fitting]
853 questions
3
votes
2 answers
How do I specify error of Y-variable when fitting with lmfit?
I'm almost new to Python and I'm trying to fit data from college using lmfit. The Y variable has a variable error of 3%. How do I add that error to the fitting process? I am changing from scipy's curve fit and in scipy it was really easy to do so,…

Agustin Bayer
- 33
- 5
3
votes
1 answer
Find the appropriate polynomial fit for data in Python
Is there a function or library in Python to automatically compute the best polynomial fit for a set of data points? I am not really interested in the ML use case of generalizing to a set of new data, I am just focusing on the data I have. I realize…

Jane Sully
- 3,137
- 10
- 48
- 87
3
votes
2 answers
2D curve fitting in Julia
I have an array Z in Julia which represents an image of a 2D Gaussian function. I.e. Z[i,j] is the height of the Gaussian at pixel i,j. I would like to determine the parameters of the Gaussian (mean and covariance), presumably by some sort of…

Yly
- 2,150
- 4
- 20
- 33
3
votes
1 answer
How do I 'fit a line' to a cluster of pixels?
I would like to generate a polynomial 'fit' to the cluster of colored pixels in the image here
(The point being that I would like to measure how much that cluster approximates an horizontal line).
I thought of using grabit or something similar and…

magnolia1
- 65
- 5
3
votes
1 answer
choosing step sizes when fitting under python
As you may know, the lmfit module in python is convenient to extend capabilities of scipy.optimize functionnalities.
However I don't find something that seems to me necessary: the possibility to choose the step sizes (used for partial derivations,…

Stéphane
- 1,389
- 3
- 13
- 34
3
votes
0 answers
visualize/plot keras metrics with model.fit_generator()
The usage of model.fit_generator() in keras works for me, however I'd like to have a live visualisation of accuracy, loss etc. like it is easily possible with model.fit().
Couldn't find any explanations on how to do that with the…

KatharsisHerbie
- 115
- 1
- 10
3
votes
2 answers
Fit plane to N dimensional points in MATLAB
I have a set of N points in k dimensions as a matrix of size N X k.
How can I find the best fitting line through these points? The line will be a plane (hyerpplane) in k dimensions. It will have k coefficients and one bias term.
Existing functions…

S_S
- 1,276
- 4
- 24
- 47
3
votes
0 answers
Fitting a power law for extrapolation
I am trying to figure out how to interpolate a function, and I want to be able to extrapolate a small way beyond the interpolation range. There is some background theory which leads me to expect that the behavior for large values of the dependent…

лаетековский чайник
- 51
- 4
3
votes
1 answer
Fitting data points to an ellipse with its center at the origin using R
I have a question about fitting ellipses to data with the ellipse center at the origin. I have explored two methods that fit ellipses but generate an arbitrary center unless I manipulate the data with some imaginary mirror points.
Method#01
This…

ToNoY
- 1,358
- 2
- 22
- 43
3
votes
3 answers
Power Law Fit of cut-off distribution with the poweRlaw package
I am currently trying to find a way to calculate a power-law fit for a cut-off distribution with MLE. The distribution looks as follows:
As you can see, I was able to fit the whole distribution (Power-law fit) and also the lower bound (exp-fit)…

Max
- 31
- 3
3
votes
2 answers
scipy.optimize.curve_fit failing to estimate the covariance
I want to fit data to a Logistic (Sigmoid) function and am getting infinite covariance. I have 2 parameters and suppose I have 5 data points. My data are in the variables xdata and ydata. Here is a code example which generates the exact same…

splinter
- 3,727
- 8
- 37
- 82
3
votes
1 answer
Least squares fit in python for 3d surface
I would like to fit my surface equation to some data. I already tried scipy.optimize.leastsq but as I cannot specify the bounds it gives me an unusable results. I also tried scipy.optimize.least_squares but it gives me an error:
ValueError: too many…

UN4
- 587
- 5
- 19
3
votes
1 answer
Fitting un-normalized gaussian in histogram python
I have a dark image (raw format), and plotted the image and distribution of the image. As you can see, there is a peak at 16, please ignore that. I want to fit at gaussian curve through this histogram. I've used this method to fit:
Un-normalized…

SjonTeflon
- 547
- 2
- 13
- 29
3
votes
2 answers
Fitting a sum to data in Python
Given that the fitting function is of type:
I intend to fit such function to the experimental data (x,y=f(x)) that I have. But then I have some doubts:
How do I define my fitting function when there's a summation involved?
Once the function…
user4587874
3
votes
1 answer
chi-square distribution R
Trying to fit a chi_square distribution using fitdistr() in R. Documentation on this is here (and not very useful to me): https://stat.ethz.ch/R-manual/R-devel/library/MASS/html/fitdistr.html
Question 1: chi_df below has the following output: …

Entropy
- 133
- 2
- 12