Project

loess

0.0
No commit activity in last 3 years
No release in over 3 years
Perfect if you want to plot a line graph or scatter plot and a loess regression
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0

Runtime

>= 0
 Project Readme

Loess

Simple Loess / Lowess interpolator built in Ruby, using Apache's LoessInterpolator through Rjb

Installation

Add this line to your application's Gemfile:

gem 'loess'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install loess

Depencies

This gem depends on Rjb, which in turn depends on Java. Rjb documentation has more info.

Usage

data = 1000.times.map { |i| [i, rand(10_000)] }

regression = Loess::Interpolator.interpolate(data)
regression = Loess::Interpolator.new(data).interpolate

# Change your settings

interpolator = Loess::Interpolator.new(data)
interpolator.bandwidth = 0.2
interpolator.robustness_factor = 10 # Go crazy
interpolator.interpolate

# Pass in settings through initialize
interpolator = Loess::Interpolator.new(data, bandwidth: 0.2, accuracy: 1e-10)
interpolator.interpolate

# Get a Spline Interpolator object
# Returns an instance of PolynomialSplineFunction, smoothed with the given data
# More documentation at [Apache Commons Maths][2]
interpolator.spline_interpolator

Contributing

At this moment, there is little to contribute, but still:

  1. Fork it ( https://github.com/swanandp/loess.rb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request