Questions tagged [cubic-spline]

A cubic spline is a smooth 3-order polynomial function that is piecewise-defined, and possesses a high degree of smoothness at the knots where the polynomial pieces connect.

A cubic spline is a smooth 3-order polynomial function that is piecewise-defined, and possesses a high degree of smoothness at the knots where the polynomial pieces connect. The most common cubic splines are Hermite, B-splines and Bezier splines.

Further details can be found at the sites below:

  1. wikipedia
  2. mathematica
170 questions
1
vote
2 answers

cubic spline regression with sklearn?

I want to regress very accurately a target which depends non-linearly from a single variable x. In my sklearn pipeline, I use: pipe = Pipeline([('poly', PolynomialFeatures(3, include_bias=False)), \ ('regr',…
1
vote
1 answer

How to generate a cubic spline with a specified maximum curvature and ending tangents?

I want to do this in Python, and preferably SciPy. The tangent at the beginning and end of the spline are specified. Assume I have a sequence of waypoints I want the spline to pass through np.array([ [-18., -20.], [-18., 18.], [-14., …
cisprague
  • 71
  • 8
1
vote
0 answers

How to generate a unit-length cubic spline and smoothly extend it another one?

Background I want to generate a unit-length cubic spline (arc length of 1), with way- or control-points as the input. I then want to generate another unit-length cubic spline in the same way, having it smoothly connect from the previous spline. I…
cisprague
  • 71
  • 8
1
vote
0 answers

Making predictions for a regression model with cubic splines in Python

I'm building a linear regression model where one of the input variables is number of sales. Rather than using the number of sales per day as a linear input, I want to use some form of cubic spline transformation (because it tends to tail off after a…
DB_DS
  • 29
  • 2
1
vote
0 answers

Finding Points of Inflection in an Image Contour

I'm working on finding the inflection points of an image contour, which for a typical function are the set of points where the double derivative vanishes. Although I seem to have been able to tackle the problem for synthetic data but for actual…
1
vote
0 answers

How to integrate a cubic spline?

I have trouble compiling code to integrate a cubic spline. I have given a list of numbers from which I compute a cubic spline via a function in boost. This works so far. Now I want to calculate for example the length of the spline or just the area…
Emil08Vogt
  • 11
  • 2
1
vote
0 answers

how to use cubic interpolation in ceres solver

It’s my first time to use ceres to optimize my project, i know it not very well. wenn I follow example to write my project, it is not compilable. here is my code and my error (black one)and the code what i found in Gitlab(white one). u,v is pixel…
ubdmf
  • 11
  • 2
1
vote
0 answers

Is there a way to create a cubic interpolation function for scattered data in 3D (x, y, z) in Matlab?

I am looking for a function in Matlab that constructs a cubic interpolation function, Z = f(X, Y), for irregularly spaced data. Basically, Matlab's griddedInterpolant function is what I'm looking for in terms of interpolation Method, whereas I'm…
Sam
  • 305
  • 1
  • 8
1
vote
1 answer

AttributeError: module 'scipy.interpolate' has no attribute 'spline'

I'm using Python 3.6 and trying to run the following code which is from here: from __future__ import division import numpy as np import matplotlib.pyplot as plt import scipy.interpolate x = np.array([ 2., 1., 1., 2., 2., 4., 4., 3.]) y =…
ah bon
  • 9,293
  • 12
  • 65
  • 148
1
vote
1 answer

Dfmacox and SmoothHr: errors in running codes

I am trying to run a code for a statistical analysis from my dataset (non parametric estimate of hazard ratio curves for continuous predictors). This is my dataset: db2 <-structure(list(IBM = c(2, 3, 2, 5, 0, 0, 3, 0, 0, 4, …
John M.
  • 51
  • 5
1
vote
0 answers

How is it possible to calculate a multidimensional interpolation on position (lat/long) and time data in python?

I would like to perform a multidimensional interpolation on my data. My data has the following structure: Time, Latitude, Longitude, Speed, Course. At the moment I split the data into 4 separate time series, like: (Time, Latitude), (Time, Longitude)…
Braveness
  • 49
  • 7
1
vote
2 answers

How to interpolate a single ("non-piecewise") cubic spline from a set of data points?

From a set of data points, I wish to generate a single cubic spline function, that best fits the points. That is, seeking to obtain a single 3rd order polynomial function, that best-fits the data - as opposed to a piecewise polynomial. (the…
Mtl Dev
  • 1,604
  • 20
  • 29
1
vote
0 answers

Scaling data before or after creating Cubic Spline variables?

Should I standardize my features before or after applying Splines? More specifically, I am running the following code to transform my features: transformed_x = dmatrix("bs(Data, df=6, degree=3, include_intercept=False)-1", …
John
  • 555
  • 3
  • 16
1
vote
0 answers

Interpolation of a 3D regular griddata using scipy.interpolate.Rbf

This h5 file contains the information of an analytical function on a regular 3D gird. For interpolation purpose, I have got very poor result using the Regulargridinterpolator here. Now, I want to test scipy.interpolate.Rbf interpolator for my data…
Photon
  • 159
  • 3
  • 12
1
vote
1 answer

How to make the spline function work on a nested lists

I'm trying to pass a nested list to a spline function. I have quarterly rainfall values for two cities for two consecutive years. I am trying to execute a spline interpolation such that I may get back monthly values for those years Here's what I…
Ayan
  • 145
  • 2
  • 16