Git Product home page Git Product logo

cylowess's Introduction

Requirements:

Numpy  >= 1.7.0
Cython >= 0.18 (if you want to tweak the generated C code)

Note: This content is extracted from here: https://github.com/fooblahblah/Will_it_Python/tree/master/MLFH/CH2/lowess%20work

Files for an improved version of statsmodel's lowess.

cylowess.pyx is Cython code for a faster version of the lowess function
in statsmodels.nonparametric.lowess.

This code is more or less a from-scratch re-write, borrowing from both
statsmodel's lowess, and from W. Cleveland's original lowess.f Fortran code.

The main speed improvements come from:

1. Replacing expensive lstsq() calls in the statsmodel versions with direct
   calculations of the fitted y-values.
2. General Cython-based speedups for simple procedures in tight loops (like
   updating k-nearest neighbors).
3. But mostly the implementation of local linear interpolation via the new
   delta parameter. This vastly reduces the amount of times weighted regressions
   are run with minimal effect on the results. The idea, is to only run regression
   at points spaced at most `delta` apart, then linearly interpolate between those
   two results.
   For moderate to large data (N > 5000) this cuts timings about 50-100x--from
   seconds to milliseconds Currently, the default delta is zero, so the feature
   is not implemented unless explicitly set by the user. This should probably
   change.

See the IPython notebook for comparisons with statsmodels and R lowess. CSV files
are exported R data that are loaded into the notebook.

-C. Vogel
 May 2012

cylowess's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cylowess's Issues

LICENSE missing

Hi,

it would be great if a license could be added to this project. Otherwise, it's hard to package it up and distribute it.

Thanks,
Bjoern

type errors on example code

Hi,

I'm using numpy '1.11.1', cython '0.24', and python 3.5.1. and I'm getting errors with your example code.

Running the example code from the pyx:
>>> x = np.random.uniform(low = -2*np.pi, high = 2*np.pi, size=500) >>> y = np.sin(x) + np.random.normal(size=len(x)) >>> z = lowess(y,x)

gives the error:
ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.