Comments (4)
I'm considering adding multivariate support following the style of a general additive model.
from piecewise_linear_fit_py.
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
, orfit_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.
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.
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)
- .fit() fails with 1 segment HOT 5
- How to force the fit process to have a fixed Intercept? HOT 1
- Can I get y_values if I have only x and slopes values? HOT 1
- Limit the slope of each segment of the curve HOT 1
- Re-constructing Piecewise PWLF HOT 2
- Set Slope of Segment to 0 HOT 2
- How to fit multiple functions simultaneously HOT 3
- Hi, i want to make sure that there are no fitted lines between points that are too far apart i.e. set a min value( fragment optimization) how to achieve this? HOT 1
- Why last beta is always positive? HOT 3
- How to prevent poor fitting HOT 4
- Forcing the segments to be integers and not float
- p values does not seem accurate HOT 3
- Error for coefficients of linear equations HOT 7
- pwlf with unknown line segments HOT 9
- assure the slopes to be lower and lower HOT 1
- divide by zero error in calc slopes if two break points are the same, or if a breakpoint is on the boundary HOT 2
- Issue using .fit() HOT 5
- How to plot segments with fit_breaks information HOT 4
- support random seed on init
- How to calculate prediction intervals? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piecewise_linear_fit_py.