项目作者: nignatiadis

项目描述 :
Cubic smoothing splines in Julia.
高级语言: Julia
项目地址: git://github.com/nignatiadis/SmoothingSplines.jl.git
创建时间: 2016-05-31T12:21:28Z
项目社区:https://github.com/nignatiadis/SmoothingSplines.jl

开源协议:Other

下载


SmoothingSplines

Build Status
Coverage

A Julia package for nonparametric regression with Cubic Smoothing Splines. The initial aim is to provide the same functionality as R’s smooth.spline function and competitive computational performance. The implementation however is completely independent of the R function and based on the algorithm by Reinsch [1], as described in Chapter 2 of [2].

  1. using SmoothingSplines
  2. using RDatasets
  3. using Gadfly
  4. cars = dataset("datasets","cars")
  5. X = map(Float64,convert(Array,cars[!,:Speed]))
  6. Y = map(Float64,convert(Array,cars[!,:Dist]))
  7. spl = fit(SmoothingSpline, X, Y, 250.0) # λ=250.0
  8. Ypred = predict(spl) # fitted vector
  9. plot(layer(x=X, y=Y, Geom.point),
  10. layer(x=X, y=Ypred, Geom.line, Theme(default_color=colorant"red")))
  11. predict(spl, 20.0) #prediction at arbitrary point

TODO

  • Better docs
  • conversion between regularization parameter λ and degrees of freedom
  • automatic selection of λ (LOOCV, GCV)
  • subsampling of design grid for higher efficiency

References

[1] Reinsch, Christian H. “Smoothing by spline functions.” Numerische mathematik 10.3 (1967): 177-183.

[2] Green, Peter J., and Bernard W. Silverman. Nonparametric regression and generalized linear models: a roughness penalty approach. CRC Press, 1993.