Git Product home page Git Product logo

lowess's Introduction

lowess

Coverage Status

This is a python implementation of the LOWESS algorithm for locally linear regression described in Cleveland (1979) and in chapter 6 of Friedman, Hastie and Tibshirani (2008).

Friedman, Hastie and Tibshirani (2008). The Elements of Statistical Learning.

Cleveland (1979). Robust Locally Weighted Regression and Smoothing Scatterplots. J American Statistical Association, 74: 829-836.)

#Examples

>>> import lowess as lo
>>> import numpy as np

# For the 1D case:
>>> x = np.random.randn(100)
>>> f = np.cos(x) + 0.2 * np.random.randn(100)
>>> x0 = np.linspace(-1,1,10)
>>> f_hat = lo.lowess(x, f, x0)
>>> import matplotlib.pyplot as plt
>>> fig,ax = plt.subplots(1)
>>> ax.scatter(x,f)
>>> ax.plot(x0,f_hat,'ro')
>>> plt.show()

# 2D case (and more...)
>>> x = np.random.randn(2, 100)
>>> f = -1 * np.sin(x[0]) + 0.5 * np.cos(x[1]) + 0.2*np.random.randn(100)
>>> x0 = np.mgrid[-1:1:.1, -1:1:.1]
>>> x0 = np.vstack([x0[0].ravel(), x0[1].ravel()])
>>> f_hat = lo.lowess(x, f, x0, kernel=lo.tri_cube)
>>> from mpl_toolkits.mplot3d import Axes3D
>>> fig = plt.figure()
>>> ax = fig.add_subplot(111, projection='3d')
>>> ax.scatter(x[0], x[1], f)
>>> ax.scatter(x0[0], x0[1], f_hat, color='r')

lowess's People

Contributors

arokem avatar

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.