mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-28 18:27:14 +08:00
b40ebdcfce
Adds a new ``downsample`` method to all computable terms. Computable terms (Filters, Factors, and Classifiers) can be downsampled to yearly, quarterly, monthly, or weekly frequency. The result of ``term.downsample`` is a new term of the same family (Filter/Factor/Classifier) as ``term``. The downsampled term computes by delegating to the original term; repeatedly calling its ``compute`` method with length-1 date ranges. Downsampled terms take advantage of a new ``compute_extra_rows`` Term method, which allows terms to dynamically request that additional extra rows of themselves be computed based on the dates for which they're being computed. This ensures, for example, that a monthly-downsampled term always computes at the start of a month, even when a naively-calculated pipeline window would end in the middle of the month.