Approximating via step function

Hello,

I was wondering whether anyone knows of a package/function that approximates a function with a step function. As an example, below in blue is the data I am trying to approximate, in red is my wanted output (a step function).

step_approx

https://github.com/ajtulloch/Isotonic.jl

3 Likes

I think you want a simple regression tree. The number of “steps” is equal to the number of leaves… MLJ.jl gives access to various options.