Giter Club home page Giter Club logo

Comments (4)

cjekel avatar cjekel commented on May 22, 2024

I could potentially create a constrained fit where each breakpoint is subjected to per-determined constraints. The following code sets up this constraint lower and upper limits, just as an example.

# for two breakpoints; arbitrary example 
# 0.1 <= breakpoint[0] <= 0.15
# 0.5 <= breakpoint[1] <= 0.7
g = np.zeros((2, 2)  # constraints
g[0, 0] = 0.1
g[0, 1] = 0.15
g[1, 0] = 0.5
g[1, 1] = 0.7

Then the optimization would find the best breakpoint subject to g.

Do I understand this correctly?

from piecewise_linear_fit_py.

cjekel avatar cjekel commented on May 22, 2024

For now this could be done using a custom optimizer like https://jekel.me/piecewise_linear_fit_py/examples.html#use-custom-optimization-routine where you manually specify the bounds.

I'll try to include an optional bounds parameter in the fitting routines for this case.

from piecewise_linear_fit_py.

cjekel avatar cjekel commented on May 22, 2024

@adussarps I'm not sure if I understand your request to constrain linear coefficients, but I added an option to constrain the search space for breakpoints. Does this example solver your issue? or are you looking to add constraints for each slope (and the change from the previous slope)?

from piecewise_linear_fit_py.

adussarps avatar adussarps commented on May 22, 2024

Yes it's fine thanks!!

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.