timeeval.adapters package¶
timeeval.adapters.base module¶
- class timeeval.adapters.base.Adapter¶
Bases:
ABCThe base class for all adapters. An adapter is a wrapper around an anomaly detection algorithm that allows to execute it in a standardized way with the TimeEval framework. A subclass of Adapter must implement the _call method that executes the algorithm and returns the results. Optionally, it can also implement the get_prepare_fn and get_finalize_fn methods that are called before and after the execution of the algorithm, respectively.
timeeval.adapters.distributed module¶
- class timeeval.adapters.distributed.DistributedAdapter(algorithm: Callable[[Union[ndarray, Path], dict], Union[ndarray, Path]], remote_command: str, remote_user: str, remote_hosts: List[str])¶
Bases:
AdapterAn adapter that allows to run a function as an anomaly detector on multiple remote machines. So far, this adapter only supports TSFunctions as algorithms. Please, be aware that you need password-less ssh to the remote machines!
Warning
This adapter is deprecated and will be removed in a future version of TimeEval.
timeeval.adapters.docker module¶
- class timeeval.adapters.docker.AlgorithmInterface(dataInput: pathlib.PurePath, dataOutput: pathlib.PurePath, modelInput: pathlib.PurePath, modelOutput: pathlib.PurePath, executionType: timeeval.data_types.ExecutionType, customParameters: Dict[str, Any] = <factory>)¶
Bases:
object- executionType: ExecutionType¶
- class timeeval.adapters.docker.DockerAdapter(image_name: str, tag: str = 'latest', group_privileges: str = 'akita', skip_pull: bool = False, timeout: Optional[Duration] = None, memory_limit_overwrite: Optional[int] = None, cpu_limit_overwrite: Optional[float] = None)¶
Bases:
AdapterAn adapter that allows to run a Docker image as an anomaly detector. You can find a list of available Docker images on GitHub.
- Parameters
image_name (
str) – The name of the Docker image to run.tag (
str) – The tag of the Docker image to run. Defaults to “latest”.group_privileges (
str) – The group privileges to use for the Docker container. Defaults to “akita”.skip_pull (
bool) – Whether to skip pulling the Docker image. Defaults to False.timeout (
Optional[Duration]) – The timeout for the Docker container. If not set, the timeout is taken from theResourceConstraints.memory_limit_overwrite (
Optional[int]) – The memory limit for the Docker container. If not set, the memory limit is taken from theResourceConstraints.cpu_limit_overwrite (
Optional[float]) – The CPU limit for the Docker container. If not set, the CPU limit is taken from theResourceConstraints.
- class timeeval.adapters.docker.DockerJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)¶
Bases:
NumpyEncoder- default(o: Any) Any¶
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
timeeval.adapters.function module¶
timeeval.adapters.jar module¶
- class timeeval.adapters.jar.JarAdapter(jar_file: str, output_file: str, args: List[Any], kwargs: Dict[str, Any], verbose: bool = False)¶
Bases:
AdapterAn adapter that allows to run a jar file as an anomaly detector.
Warning
This adapter is deprecated and will be removed in a future version of TimeEval.
- Parameters
jar_file (
str) – The path to the jar file to run.output_file (
str) – The path to the file to which the jar file writes its output.args (
List[Any]) – The arguments to pass to the jar file.kwargs (
Dict[str,Any]) – The keyword arguments to pass to the jar file.verbose (
bool) – Whether to print the output of the jar file to the console.
timeeval.adapters.multivar module¶
- class timeeval.adapters.multivar.AggregationMethod(value)¶
Bases:
EnumAn enum that specifies how to aggregate the anomaly scores of the channels.
- MAX = 2¶
aggregates channel scores using the element-wise max.
- MEAN = 0¶
aggregates channel scores using the element-wise mean.
- MEDIAN = 1¶
aggregates channel scores using the element-wise median.
- SUM_BEFORE = 3¶
sums the channels before running the anomaly detector.
- class timeeval.adapters.multivar.MultivarAdapter(adapter: Adapter, aggregation: AggregationMethod = AggregationMethod.MEAN)¶
Bases:
AdapterAn adapter that allows to apply univariate anomaly detectors to multiple dimensions of a timeseries. In one case, the adapter runs the anomaly detector on each dimension separately and aggregates the results using the specified aggregation method. In the other case, the adapter combines the dimensions into a single timeseries and runs the anomaly detector on the combined timeseries.
- Parameters
adapter (
Adapter) – TheAdapterthat runs the anomaly detector on each dimension.aggregation (
AggregationMethod) – TheAggregationMethodto use to combine the anomaly scores of the dimensions.