cjekel / piecewise_linear_fit_py

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

Proposal: non-array arguments to PiecewiseLinFit.predict() #32

Closed kingrpaul closed 5 years ago

kingrpaul commented 5 years ago

Calling predict() with a float type argument raises IndexError (vs TypeError).

        if sorted_data is False:
            # sort the data from least x to max x
            order_arg = np.argsort(x)
            x = x[order_arg]  <<--- HERE

Consider detecting non-array arguments to predict?

cjekel commented 5 years ago

I just removed the sorted keywords in the 1.0.0 release ( at least I think so).

You're right that checking for an array type would remove the error.

Is this sill an issue on 1.0.0?

On Fri, May 17, 2019, 12:35 Paul King notifications@github.com wrote:

Calling predict() with a float type argument raises IndexError (vs TypeError).

   if sorted_data is False:
       # sort the data from least x to max x
       order_arg = np.argsort(x)
       x = x[order_arg]  <<--- HERE

Consider detecting non-array arguments to predict?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cjekel/piecewise_linear_fit_py/issues/32?email_source=notifications&email_token=ADJ5Z4P4633SIHJDXTGQZFTPV3NDVA5CNFSM4HNWYGEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUOFTKA, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJ5Z4NXDIT6QK4RTQBD5W3PV3NDVANCNFSM4HNWYGEA .

kingrpaul commented 5 years ago

pip-installed yesterday Version -> 0.5.1 Sounds like this will no longer be an issue, with update?

cjekel commented 5 years ago

Sorry I haven't tested this, but does 1.0.0 avoid this issue?

On Tue, May 21, 2019, 00:31 Paul King notifications@github.com wrote:

Closed #32 https://github.com/cjekel/piecewise_linear_fit_py/issues/32.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cjekel/piecewise_linear_fit_py/issues/32?email_source=notifications&email_token=ADJ5Z4OTLXTDZVUJDNLYYQTPWLG5LA5CNFSM4HNWYGEKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGORRFE7LI#event-2353680301, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJ5Z4LRJ7IWBGPGA3WMBPDPWLG5LANCNFSM4HNWYGEA .