API Reference

next_n_hours

monad.ui.target_function.next_n_hours

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

To restrict the events to a desired number of days.

from monad.ui.target_function import next_n_hours

def target_fn(history: Events, future: Events, entity: Attributes, ctx: Dict) -> np.ndarray:
    target_window_hours = 48     
    future_constrained = next_n_hours(
        events=future,
        start=ctx[SPLIT_TIMESTAMP],
        n=target_window_hours
    )
    ...
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 hours to include, or None to return all events after start timestamp.

Returns

Events restricted to the chosen time range.