Python wrapper around R's lovely smooth.spline
import matplotlib.pyplot as plt import numpy as np from pysmoothspl import SmoothSpline n = 1000 x = np.arange(n).astype(np.float) y = 100 + 50 * np.sin(2 * np.pi * x / 365.0) + np.random.normal(0, 25, n) spl = SmoothSpline(spar=0.2).fit(x, y) yhat = spl.predict(x) spl_smoother = SmoothSpline(spar=0.5).fit(x, y) yhat_smoother = spl_smoother.predict(x) fig, ax = plt.subplots(1, figsize=(16, 9)) ax.plot(x, y, 'ro', label='Points') ax.plot(x, yhat, 'g-', label='Less smooth') ax.plot(x, yhat_smoother, 'b-', label='Smoother') ax.legend() fig.show()You will need Cython (unless/until this repo includes the *.c files) and numpy.
There are two Conda environment.yaml files to help guide the installation:
environment.yamlcontains just the needed packages for installationtests/environment.yamlcontains the packages needed to install and test this package
This package uses py.test to run tests, and you will also need pandas:
py.test tests/If rpy2 is installed, the tests will actually calculate the expected values of calculations using the copy of R it is installed against. For users without rpy2, the test data also contains "cached" answers calculated using R code.
- Object oriented sklearn-esque estimator
- For function inputs: typed memory views > NumPy buffers
- Kill the GIL
- CI service tests
- Code coverage checks with CI
- Check output against literal R output via rpy2
- Implement more features
- Cross validation
- Derivatives (hint: check
bvaluecode for commented out)
- Work back from fresh copy of R code...
