Giter Club home page Giter Club logo

Comments (4)

cjekel avatar cjekel commented on May 22, 2024 5

I'm considering adding multivariate support following the style of a general additive model.

from piecewise_linear_fit_py.

cjekel avatar cjekel commented on May 22, 2024 1

Where is the code?

Branch multivariate has an initial multivariate pwlf model.

How this works

The final function follows the style of a general additive model (GAM), where 1D piecewise continuous fits are performed for each univariate feature. The 1D models can be assembled in polynomial form, with default multivariate_degree=1. Finally a least square solution provides the final parameters of the additive model.

Examples

I'm still working on the syntax, but the general idea will be something like this

"""
        x : ndarray (2-D)
            The x or independent data point as a 2 dimensional numpy array.
            This should be of shape (n, m), for n number of data points, and m
            number of features.
        y : array_like
            The y or dependent data point locations as list or 1 dimensional
            numpy array.
"""
n_segments = 2  # number of line segments for each univariate
my_mv_model = pwlf.PiecewiseMultivariate(x, y, n_segments,
                                         degree=1,  # degree of each univariate
                                         multivariate_degree=3  # degree of the GAM
)
my_mv_model.fit()

I believe these fits to the Branin-Hoo function shows some promise: https://github.com/cjekel/piecewise_linear_fit_py/blob/multivariate/examples/multivariate/braninhoo.py

Fits to the Adjiman function https://github.com/cjekel/piecewise_linear_fit_py/blob/multivariate/examples/multivariate/adjiman.py

To do

What this need in order to be merged into master:

  • documentation
  • tests
  • fit options (e.g. fitfast, fit, or fit_guess)
  • fit optimization keyword support
  • consider cross univariate terms (e.g. F(x) = b0 + b1*x1 + b2*x2 + b3*x1*x2 ...)
  • considerations of advanced use cases?

Feel free to chime in for features, or comments about the api.

from piecewise_linear_fit_py.

cjekel avatar cjekel commented on May 22, 2024

Multivariate (or high dimensional) piecewise regression can get complicated quickly.

I don't have any current plan for expanding pwlf to higher dimensions, but the conversation has come up before. There are some physical problems with insight that might be better described by a segmented regression problem.

I'm fairly committed at the moment, but I could implement some methods from http://www3.stat.sinica.edu.tw/statistica/oldpdf/A7n213.pdf at some future time

This brings up another point, should pwlf support non-continuous piecewise linear regression?

from piecewise_linear_fit_py.

qingzma avatar qingzma commented on May 22, 2024

I agree.... multivariate piecewise linear regression grow complicated very quickly, and I do not find any package to support this function yet.
Anyway, thanks so much for the reply!

from piecewise_linear_fit_py.

Related Issues (20)

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.