Comments (3)
Upd. Here is the data and code:
x = np.array([-0.8194154 , -0.64332414, -0.51838541, -0.46722015, -0.3422846 ,
-0.21734825, -0.16619652, -0.12043967, -0.0412546 , 0.05564586,
0.08368175, 0.13484621, 0.1805846 , 0.25978495, 0.35667586,
0.38471174, 0.43586029, 0.48161459, 0.53277985, 0.560803 ,
0.6577154 , 0.68574174, 0.73689028, 0.78265175, 0.83380348,
0.861833 , 0.9587454 , 0.98677173, 1.03790436, 1.08368175,
1.13484621, 1.16286299, 1.25978495, 1.33895425, 1.38471174,
1.43586029, 1.46389299, 1.560803 , 1.63998425, 1.68574174,
1.73689028, 1.76492298, 1.861833 , 1.94101424, 1.98677173,
2.03790436, 2.16286299, 2.33895425])
y = np.array([-0.8907928 , -0.75500583, -0.64727736, -0.64650693, -0.51433535,
-0.38166944, -0.40255713, -0.16220961, -0.23907264, -0.08629738,
-0.08070743, -0.10171921, 0.12456943, 0.08507641, 0.34500104,
0.11968469, 0.25837385, 0.46664523, 0.62630957, 0.44249545,
0.72326681, 0.45026451, 0.70079022, 0.86618688, 1.00060759,
0.91496691, 1.13741741, 0.92408795, 1.20806495, 1.3476422 ,
1.43581253, 1.31152076, 1.60827993, 1.61206297, 1.72485727,
1.88401327, 1.79035555, 1.99959592, 2.07903646, 2.1498347 ,
2.27258415, 2.29909307, 2.4168235 , 2.53288172, 2.61879047,
2.67065397, 2.81012494, 2.92261129])
import pwlf
import matplotlib.pyplot as plt
import numpy as np
myPWLF = pwlf.piecewise_lin_fit(x,y)
res = myPWLF.fit(2)
xHat = np.linspace(min(x), max(x), num=10000)
yHat = myPWLF.predict(xHat)
plt.figure()
plt.plot(x,y,'o')
plt.plot(xHat,yHat, '-')
plt.show()
from piecewise_linear_fit_py.
V.,
Thanks for giving me your code! I was able to reproduce the issue.
I have no idea why I was preventing the first two variables to be the same.
Can you install the new version- and test to see if this fixes your problem?
pip install --upgrade git+https://github.com/cjekel/piecewise_linear_fit_py
Thanks,
CJ
per commit a14c5ae
if this fixes your issue, I'll upload to pip
from piecewise_linear_fit_py.
I've updated the code and it works perfectly.
Thank you!
V.
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.