Questions tagged [data-fitting]

Data fitting is to fit a line through a data set i.e. a series of data points.

853 questions
4
votes
1 answer

Cross validation: cross_val_score function from scikit-learn arguments

According to the DOC of scikit-learn sklearn.model_selection.cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch=‘2*n_jobs’) X and y X : array-like The data to fit. Can be…
4
votes
2 answers

Fitting a curve with a pivot point Python

I have the plot below and I want to fit it with 2 lines. Using python I manage to fit the upper part: def func(x,a,b): x=np.array(x) return a*(x**b) popt,pcov=curve_fit(func,up_x,up_y) And I want to fit the lower part with another line, but…
4
votes
1 answer

Fit a sigmoid to my data using MATLAB

I have a lot of data, and I think it is possible to fit it to a sigmoid (this thought based on my eye-sight, not a mathematical formula). How can I find the parametric form with statistically significant explanatory power of the best sigmoid for my…
user3094996
  • 53
  • 1
  • 1
  • 7
4
votes
2 answers

How to do a fit with gnuplot using data with error in x and y?

How to do a fit with data like x y deltax delta y? I have to do a linear fit weighted to the error in both axis what is the exact syntax? Fit f (x) "file.txt" u1:2:3:4 via a, b with xyerrorbars. f (x) =a*x + b Result: singular matrix in invert_RtR
physnolimits
  • 195
  • 2
  • 2
  • 5
4
votes
1 answer

Extracting coefficients with a nonlinear Kernel using sklearn.svm python

This may not be possible in theory, if so please elaborate. I am trying to fit some data with Python's sklearn SVM class sklearn SVM class When I use a linear kernel, I can extract the coefs using get_params method where coef_ : array, shape =…
Tim
  • 135
  • 1
  • 11
4
votes
1 answer

How to perform local polynomial fitting in Python

I have 200k data points and I'm trying to obtain derivative of fitted polynomial. I divided my data set into smaller ones every 0.5 K, the data is Voltage vs Temperature. My code roughly looks like this: import pandas as pd import numpy as np import…
GPM
  • 105
  • 5
4
votes
1 answer

Miscellaneous range of stat_smooth()

The ggplot2-function stat_smooth() has the option fullrange=TRUE or FALSE which decides if the fit is drawn over the range of the data or the range of the graph. Is there a way to give the stat_smooth() a miscellaneous range ? E.g. if my plot has x…
ruben baetens
  • 2,806
  • 6
  • 25
  • 31
4
votes
1 answer

data fitting an ellipse in 3D space

Forum I've got a set of data that apparently forms an ellipse in 3D space (not an ellipsoid, but a curve in 3D). Being inspired by following thread http://au.mathworks.com/matlabcentral/newsreader/view_thread/65773 and with the help from someone…
4
votes
0 answers

Maximum Splin/ Fit for data?

Lets assume I have a some noisy data d(x), like a function f(x) with some noise g(x) which is strongly dependent on x, with d(x) = f(x) + g(x). Is there a clean way to fit or use a spline, lets call it s(x), such that s(x) is smooth s(x) > d(x) for…
varantir
  • 6,624
  • 6
  • 36
  • 57
4
votes
2 answers

Python circle fitting to data points less sensitive to random noise

I have a set of measured radii (t+epsilon+error) at an equally spaced angles. The model is circle of radius (R) with center at (r, Alpha) with added small noise and some random error values which are much bigger than noise. The problem is to find…
Oscar
  • 43
  • 1
  • 5
4
votes
3 answers

Scipy leastsq: fitting a square grid to experimental points in 2D

I'm trying to use Scipy leastsq to find the best fit of a "square" grid for a set of measured points coordinates in 2-D (the experimental points are approximately on a square grid). The parameters of the grid are pitch (equal for x and y), the…
user2304916
  • 7,882
  • 5
  • 39
  • 53
4
votes
1 answer

polyfit refining: setting polynomial to be always possitive

I am trying to fit a polynomial to my data, e.g. import scipy as sp x = [1,6,9,17,23,28] y = [6.1, 7.52324, 5.71, 5.86105, 6.3, 5.2] and say I know the degree of polynomial (e.g.: 3), then I just use scipy.polyfit method to get the polynomial of…
schmi
  • 397
  • 3
  • 15
4
votes
7 answers

Sine wave frequency fitting

This question is based on a previous similar question. I have the following equation and an adjusted (some random data): 0.44*sin(N* 2*PI/30) I am trying to use the FFT to get the frequency from the data generated. However the frequency ends up…
monksy
  • 14,156
  • 17
  • 75
  • 124
4
votes
2 answers

Why does scipy.optimize.curve_fit not fit correctly to the data?

I've been trying to fit a function to some data for a while using scipy.optimize.curve_fit but I have real difficulty. I really can't see any reason why this wouldn't work. # encoding: utf-8 from __future__ import (print_function, …
user2870269
4
votes
1 answer

dividing data and fitting in R

I've the following rainfall data for the year…
jkp
  • 155
  • 2
  • 7