dmbee / seglearn

Python module for machine learning time series:
https://dmbee.github.io/seglearn/
BSD 3-Clause "New" or "Revised" License
570 stars 63 forks source link

Add FunctionXYTransformer #13

Closed qtux closed 5 years ago

qtux commented 5 years ago

Hi David,

I added a generic transformer which allows one to arbitrarily transform the data (Xt and yt) before or after segmentation using a custom function. Useful examples which come to mind are:

I added a safeguard against unintentional sub- or oversampling of the data as this would affect the training data (which is fine) and the test data (which is not fine) . The safeguard can be deactivated to allow for legitimate use cases similar to segmentation or interpolation of the data.

Could you please verify if my reasoning is correct. I would remove the last two commits if it were not.

Cheers, Matthias

dmbee commented 5 years ago

Thanks Matthias. I'll take a closer look on Monday.

dmbee commented 5 years ago

Hi Matthias, what use cases that change the number of samples would you envision beyond interpolation and segmentation?

If you restrict the number of samples in each series to be the same pre and post transform, than would it not make more sense to implement this as a transformer only on X (which would allow filtering, column selection, etc) which seem like very sensible use cases.

Thanks again for this contribution.

qtux commented 5 years ago

Hi David,

I believe you are right, I can think of no other reasons for changing the number of samples in this transformer. I will adapt this and create another pull request for a transformer which operates solely on X with the enforcement of keeping the number of samples unmodified.

Cheers, Matthias

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 144


Totals Coverage Status
Change from base Build 137: 0.3%
Covered Lines: 1486
Relevant Lines: 1576

💛 - Coveralls