Files
drift/labeling/types.py
T
Mark Aron Szulyovszky 567cd5e9f0 refactor(Evaluate): print out accuracy, f1, etc. for the final & meta predictions, separated out evaluation step (#228)
* refactor(Evaluate): print out accuracy, f1, etc. for the final & meta predictions, separated out evaluation step

* fix(Linter): ran

* fix(Tests): syntax change

* fix(Inference): runs now again

* fix(Linter): ran
2022-03-03 17:40:17 +01:00

37 lines
929 B
Python

from data_loader.types import ReturnSeries, ForwardReturnSeries
from abc import ABC, abstractmethod
import pandas as pd
import pandera as pa
from pandera.typing import DataFrame, Series
from typing import Callable
class EventFilter(ABC):
@abstractmethod
def get_event_start_times(self, returns: ReturnSeries) -> pd.DatetimeIndex:
raise NotImplementedError
class EventSchema(pa.SchemaModel):
start: Series[pd.Timestamp]
end: Series[pd.Timestamp]
label: Series[int]
returns: Series[float]
EventsDataFrame = DataFrame[EventSchema]
class EventLabeller(ABC):
@abstractmethod
def label_events(
self, event_start_times: pd.DatetimeIndex, returns: ReturnSeries
) -> EventsDataFrame:
raise NotImplementedError
def get_labels(self) -> list[int]:
raise NotImplementedError
def get_discretize_function(self) -> Callable:
raise NotImplementedError