cpdbench.dataset.CPDDataset
1from abc import abstractmethod, ABC 2from numpy import ndarray 3 4 5class CPDDataset(ABC): 6 """ 7 Abstract class representing a dataset. 8 """ 9 10 @abstractmethod 11 def init(self) -> None: 12 """ 13 Initialization method to prepare the dataset. 14 Examples: Open a file, open a db connection etc. 15 """ 16 pass 17 18 @abstractmethod 19 def get_signal(self) -> tuple[ndarray, list[int]]: 20 """ 21 Returns the timeseries as numpy array. 22 :return: A 2D ndarray containing the timeseries (time x feature) 23 """ 24 pass 25 26 @abstractmethod 27 def get_validation_preview(self) -> tuple[ndarray, list[int]]: 28 """Return a smaller part of the complete signal for fast runtime validation. 29 :return: A 2D ndarray containing the timeseries (time x feature) 30 """ 31 pass
class
CPDDataset(abc.ABC):
6class CPDDataset(ABC): 7 """ 8 Abstract class representing a dataset. 9 """ 10 11 @abstractmethod 12 def init(self) -> None: 13 """ 14 Initialization method to prepare the dataset. 15 Examples: Open a file, open a db connection etc. 16 """ 17 pass 18 19 @abstractmethod 20 def get_signal(self) -> tuple[ndarray, list[int]]: 21 """ 22 Returns the timeseries as numpy array. 23 :return: A 2D ndarray containing the timeseries (time x feature) 24 """ 25 pass 26 27 @abstractmethod 28 def get_validation_preview(self) -> tuple[ndarray, list[int]]: 29 """Return a smaller part of the complete signal for fast runtime validation. 30 :return: A 2D ndarray containing the timeseries (time x feature) 31 """ 32 pass
Abstract class representing a dataset.
@abstractmethod
def
init(self) -> None:
11 @abstractmethod 12 def init(self) -> None: 13 """ 14 Initialization method to prepare the dataset. 15 Examples: Open a file, open a db connection etc. 16 """ 17 pass
Initialization method to prepare the dataset. Examples: Open a file, open a db connection etc.
@abstractmethod
def
get_signal(self) -> tuple[numpy.ndarray, list[int]]:
19 @abstractmethod 20 def get_signal(self) -> tuple[ndarray, list[int]]: 21 """ 22 Returns the timeseries as numpy array. 23 :return: A 2D ndarray containing the timeseries (time x feature) 24 """ 25 pass
Returns the timeseries as numpy array.
Returns
A 2D ndarray containing the timeseries (time x feature)
@abstractmethod
def
get_validation_preview(self) -> tuple[numpy.ndarray, list[int]]:
27 @abstractmethod 28 def get_validation_preview(self) -> tuple[ndarray, list[int]]: 29 """Return a smaller part of the complete signal for fast runtime validation. 30 :return: A 2D ndarray containing the timeseries (time x feature) 31 """ 32 pass
Return a smaller part of the complete signal for fast runtime validation.
Returns
A 2D ndarray containing the timeseries (time x feature)