Giter Club home page Giter Club logo

Comments (3)

vkhodygo avatar vkhodygo commented on May 22, 2024

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.

cjekel avatar cjekel commented on May 22, 2024

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.

vkhodygo avatar vkhodygo commented on May 22, 2024

I've updated the code and it works perfectly.
Thank you!
V.

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.