API Reference

next_n_days

monad.ui.target_function.next_n_days

monad.ui.target_function.next_n_days(events, start, n)

To restrict the events to a desired number of days.

from monad.ui.target_function import next_n_days


def target_fn(history: Events, future: Events, entity: Attributes, ctx: Dict) -> np.ndarray:
    # constrain future events to the next 21 days from split timestamp
    target_window_days = 21
    future_constrained = next_n_days(
        events=future,
        start=ctx[SPLIT_TIMESTAMP],
        n=target_window_days
    )
    
    ...
Parameters

events : Events
Events to filter.


start : float
Default: None
The timestamp indicating the starting point for events to be considered after applying the filter.


n: int | None
Default: None
Number of days to include, or None to return all events after start timestamp.

Returns

Events restricted to the chosen time range.