cjekel / piecewise_linear_fit_py

fit piecewise linear data for a specified number of line segments
MIT License
289 stars 59 forks source link

Can pwlf predict on multidimensional input? #52

Open CalvinNeo opened 4 years ago

CalvinNeo commented 4 years ago

I found this document gives demos which predict on a one-dimension input array x. According to your comments, I find that this model seems only supports 1-d input array

        x : array_like
            The x or independent data point locations as list or 1 dimensional
            numpy array.

I just wondering if pwlf can predict on multidimensional input such as the following, and I provide something like a fit_breaks list, which tells pwlf to break on certain values of clock? Moreover, if I want to remove the clock feature afterwards, is it possible?

clock    feat1    feat2
0            1           2
100        3           4
cjekel commented 4 years ago

I have an experimental branch with N-dimensional support. See https://github.com/cjekel/piecewise_linear_fit_py/issues/8#issuecomment-549979321

Idk if this is the type of formulation you want. This will perform pwlf on each variable separately, then combine all of the 1D models for a higher dimensionality.