Skip to content

Zsailer/skspline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scikit Spline

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

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()

docs/_img/example.png

About

A Scikit-learn interface on Scipy's spline.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages