An open API service indexing awesome lists of open source software.

https://github.com/zsailer/skspline

A Scikit-learn interface on Scipy's spline.
https://github.com/zsailer/skspline

scikit-learn scipy

Last synced: 2 months ago
JSON representation

A Scikit-learn interface on Scipy's spline.

Awesome Lists containing this project

README

          

Scikit Spline
=============

A Scikit-learn interface on Scipy's ``Univariate Spline``.

.. code-block:: python

import matplotlib.pyplot as plt
import numpy as np
import skspline

# Simulate data.
x = np.linspace(0, 4, 100)
y = 10*np.sin(x)
yerr = np.random.randn(len(y))

# Add noise to y.
y = y + yerr

# Initialize a Scikit Spline model and fit.
m = skspline.Spline(k=2)
m.fit(x, y)

# Get model
xmodel = np.linspace(0, 4, 1000)
ymodel = m.predict(xmodel)

# plot data and model
plt.scatter(x, y)
plt.plot(xmodel,ymodel, color='k', linewidth=5)
plt.show()

.. image:: docs/_img/example.png
:scale: 50 %