alteryx / compose

A machine learning tool for automated prediction engineering. It allows you to easily structure prediction problems and generate labels for supervised learning.
https://compose.alteryx.com
BSD 3-Clause "New" or "Revised" License
492 stars 46 forks source link

Offset Mapping #58

Closed jeff-hernandez closed 4 years ago

jeff-hernandez commented 5 years ago

Offset aliases are not user friendly. Would be helpful to create a mapping to easily specify which offset to use. Couple suggestion in the examples below.

lm = cp.LabelMaker( window_size=first_of_every.months(2), ... )

kmax12 commented 5 years ago

it seems to me window size can be

  1. an fixed amount of time (1 month, 10 observations, 6 days, etc)
  2. until some stop time (1st of month, end of year, next day)

I think the case where it is an amount of time is easy because it's just <VALUE><SPACE><UNIT>.

the until case is a little tougher, but perhaps we start by just hardcoding some common patterns. anything more complex, you'd have to use pandas offsets

Until start of next <UNIT>

jeff-hernandez commented 5 years ago

Okay, sounds good. Will start with this template.

until start of next <unit>

Then maybe later can be:

until start of next <value><space><unit>
jeff-hernandez commented 4 years ago

There are offsets available for these time spans.

'Until start of next year'  # ->  pd.offsets.YearBegin
'Until start of next month' # ->  pd.offsets.MonthBegin

However, I didn't see any for these.

Until start of next week
Until start of next day
Until start of next hour