List-schedule, without available data.#

Using an explicit schedule without data, showing number of hours in each partition.

import pandas

from rics import configure_stuff
from rics.ml.time_split import log_split_progress, plot, split

configure_stuff(format="[%(name)s:%(levelname)s] %(message)s")

data = pandas.date_range("2022", "2022-1-21", freq="38min")
config = dict(schedule="0 0 * * MON,FRI", before="all", after="3d", available=data)

plot(**config)
time_split.split(schedule='0 0 * * MON,FRI', before='all', after='3d', available=pandas.DatetimeIndex)
👻 Configured some stuff just the way I like it!

<Axes: title={'center': "time_split.split(schedule='0 0 * * MON,FRI', before='all', after='3d', available=pandas.DatetimeIndex)"}, ylabel='Fold'>

Note that the last timestamp (‘2022-01-14’) of the schedule was not included; this is because it was used as the end date (since after=1) of the second-to-last timestamp (‘2022-01-10’), which expands the Future data until the next scheduled time.

for fold in log_split_progress(split(**config), logger="my-logger"):
    print("Doing work..")
[rics.ml.time_split:INFO] Available data limits have been expanded (since flex='auto'):
  start: 2022-01-01 00:00:00 -> <no change>
    end: 2022-01-20 23:26:00 -> 2022-01-21 (+34m)
[my-logger:INFO] Begin fold 1/5: ('2022-01-01' <= [schedule: '2022-01-03' (Monday)] < '2022-01-06').
Doing work..
[my-logger:INFO] Finished fold 1/5 [schedule: '2022-01-03' (Monday)] after 27μs.
[my-logger:INFO] Begin fold 2/5: ('2022-01-01' <= [schedule: '2022-01-07' (Friday)] < '2022-01-10').
Doing work..
[my-logger:INFO] Finished fold 2/5 [schedule: '2022-01-07' (Friday)] after 22μs.
[my-logger:INFO] Begin fold 3/5: ('2022-01-01' <= [schedule: '2022-01-10' (Monday)] < '2022-01-13').
Doing work..
[my-logger:INFO] Finished fold 3/5 [schedule: '2022-01-10' (Monday)] after 21μs.
[my-logger:INFO] Begin fold 4/5: ('2022-01-01' <= [schedule: '2022-01-14' (Friday)] < '2022-01-17').
Doing work..
[my-logger:INFO] Finished fold 4/5 [schedule: '2022-01-14' (Friday)] after 21μs.
[my-logger:INFO] Begin fold 5/5: ('2022-01-01' <= [schedule: '2022-01-17' (Monday)] < '2022-01-20').
Doing work..
[my-logger:INFO] Finished fold 5/5 [schedule: '2022-01-17' (Monday)] after 21μs.

Total running time of the script: (0 minutes 0.387 seconds)

Gallery generated by Sphinx-Gallery