Questions tagged [curve-fitting]

Fitting 1-D curve to data points, minimizing pre-defined error/loss function.

From wiki:

Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points.

3428 questions
7
votes
2 answers

image analysis curve fitting

I have a bunch of images like this one: The corresponding data is not available. I need to automatically retrieve about 100 points (regularly x-spaced) on the blue curve. All curves are very similar, so I need at least 1 pixel precision, but…
Dr. Goulu
  • 580
  • 7
  • 21
7
votes
2 answers

Using OpenCV fitEllipse() for circle fitting

Is it valid to use OpenCV fitEllipse for circle fitting. fitEllipse() returns cv::RotatedRect how about averaging width and height to get fitted circle radius?
krzych
  • 2,126
  • 7
  • 31
  • 50
7
votes
1 answer

How to correctly include uncertainties in fitting with python

I am trying to fit some data points with y uncertainties in python. The data are labeled in python as x,y and yerr. I need to do a linear fit on that data in loglog scale. As a reference if the fit results are properly, i compare the python results…
user1579900
7
votes
2 answers

How to use Java Math Commons CurveFitter?

How do I use Math Commons CurveFitter to fit a function to a set of data? I was told to use CurveFitter with LevenbergMarquardtOptimizer and ParametricUnivariateFunction, but I don't know what to write in the ParametricUnivariateFunction gradient…
Italo Maia
  • 1,956
  • 3
  • 18
  • 31
7
votes
3 answers

shape-preserving piecewise cubic interpolation for 3D curve in python

I have a curve in 3D space. I want to use a shape-preserving piecewise cubic interpolation on it similar to pchip in matlab. I researched functions provided in scipy.interpolate, e.g. interp2d, but the functions work for some curve structures and…
Nader
  • 660
  • 1
  • 11
  • 17
6
votes
5 answers

Gaussian fit in C#

In a project I'm working on I need to obtain a Gaussian fit from a set of points - needing mean and variance for some processing, and possibly an error degree (or accuracy level) to let me figure out if the set of points really have a normal…
Antonio
  • 71,651
  • 11
  • 148
  • 165
6
votes
2 answers

numpy polynomial.Polynomial.fit() gives different coefficients than polynomial.polyfit()

I do not understand why polynomial.Polynomial.fit() gives coefficients very different from the expected coefficients : import numpy as np x = np.linspace(0, 10, 50) y = x**2 + 5 * x + 10 print(np.polyfit(x, y,…
manu190466
  • 1,557
  • 1
  • 9
  • 17
6
votes
3 answers

Fitting two lines to a set of 2D points

Given a set of 2D points (black dots in the picture) I need to choose two lines to somehow represent those points. I probably need to minimize the sum of squares of [distance of x to the closer of two lines]^2, although if any other metric makes…
6
votes
3 answers

Image Offset (2D Baseline) Remove in Matlab

I have an image similar to this one: and want to remove its underlying baseline so that it looks like: The image is always different, usually has some peaks and has a total absolute offset and a base surface that is tilted/curved/nonlinear. I was…
nolimits
  • 43
  • 1
  • 3
  • 16
6
votes
2 answers

Sub-quadratic algorithm for fitting a curve with two lines

The problem is to find the best fit of a real-valued 2D curve (given by the set of points) with a polyline consisting of two lines. A brute-force approach would be to find the "left" and "right" linear fits for each point of the curve and pick the…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
6
votes
5 answers

Curve Fitting 3D data set

The curve-fitting problem for 2D data is well known (LOWESS, etc.) but given a set of 3D data points, how do I fit a 3D curve (eg. a smoothing/regression spline) to this data? MORE: I'm trying to find a curve, fitting the data provided by vectors…
Jacob
  • 34,255
  • 14
  • 110
  • 165
6
votes
1 answer

How to fix "RuntimeWarning: overflow encountered in exp" when curve fitting real data in Scipy?

I'm trying to determine the best model function and parameters to use for real world data. I have several data sets that all exhibit a similar exponential decay and I want to calculate the fitted function parameters for each data set. The largest…
Dan
  • 95
  • 1
  • 5
6
votes
1 answer

Using SciPy curve_fit to predict post final score

I have a post, and I need to predict the final score as close as I can. Apparently using curve_fit should do the trick, although I am not really understanding how I should use it. I have two known values, that I collect 2 minutes after the post is…
G. Ramistella
  • 1,327
  • 1
  • 9
  • 19
6
votes
1 answer

Is there a way to make scipy curve_fit deterministic?

Tried using curve_fit (scipy API, for fitting a sigmoid) with fixed seed for numpy, but still the results vary somewhat. Is there any way to make it deterministic completely? As requested in the comments, here's a minimal working example: from…
mbison
  • 127
  • 4
6
votes
1 answer

R implementation of Genetic Algorithm for Bass Model

I try to estimate Bass Curves to analyse diffusion of innovation for different groups. Until now I use nlsLM() of the minpack.lm package to estimate the parameter of the curve/to fit the curve. I loop through different starting values to estimate…