Getting started#
Installation#
Do you use pip?
anomalearn can be installed via pip since it is published on PyPI
pip install anomalearn
Do you use conda?
Currently, anomalearn has not been published on conda, but we plan to do so in the future.
Not yet available
Not satisfied with previous instructions?
Install from source? Do you want to know dependencies? Check the detailed installation tutorial.
Quick facts#
What is the purpose of anomalearn?
The purpose of anomalearn is to ship a complete structure to ease the development of new methods for anomaly detection. It wants to aid the process of creating new models, pre-processing operations, post-processing operations, transformers, pipelines or hyperparameter search algorithms.
What kind of algorithms does anomalearn contain?
anomalearn will contain several types of algorithms that are directly used to perform anomaly detection (such as isolation forest), or algorithms which does not solve anomaly detection, but that are surrounded by processing objects or other algorithms to carry on the anomaly detection task.
What kind of experiment helpers does anomalearn contain?
anomalearn will contain objects to aid the creation of experiments to aid scientific research in computer science. An example of helper for experiment creation is the loader of datasets, which enables to easily iterate over training/testing sets, either the default (when the dataset contain a pre-defined split) or a specifically user defined split.
How do I read public datasets with anomalearn?
One of the features offered by anomalearn is that of dataset readers. These
components enable the user to instantiate a data reader object to read the
public dataset. These objects can be iterated and indexed with usual python
syntax. The return type is always a
pandas.DataFrame
.
How do I analyse data with anomalearn?
The analysis functions offered by anomalearn are all functions present in the
analysis package. These functions needs data in input and have some default
parameters to specify how the analysis must be performed. Some of the
analysis functions are implemented using numba
to be efficient.
How do I perform hyperparameter search with anomalearn?
anomalearn contains several algorithms to do research on time series anomaly
detection. The anomalearn.algorithms.tuning.hyperparameter
package
contains all the components related to hyperparameter tuning. Searchers
can be instantiated to search for optimal parameters of any function.
How do I integrate my legacy objects with anomalearn?
anomalearn follows a type-based approach with interfaces defining the
methods. If your objects implement functions such as
predict()
, you can
simply inherit from the function and it will be integrated. In some cases,
interfaces also enable duck typing, which let any legacy object to work
with anomalearn without the actual need of inheriting anomalearn’s objects.
How do I create a model with anomalearn?
anomalearn models inherit from at least one of the classes (concrete or
abstract) in anomalearn.algorithms
. Each model in anomalearn must
inherit from BaseModel
, or from
SavableModel
if it can be
safely serialized to file.
How do I create a pre-processing object with anomalearn?
anomalearn pre-processing objects inherit from interfaces located in
anomalearn.algorithms
. These models typically inherit from the
IShapeChanger
interface, and
should not be confused with transformers. They implement operations which
happen always before a model and make sense only if coupled with a model.
How do I create a post-processing object with anomalearn?
anomalearn post-processing objects inherit from interfaces located in
anomalearn.algorithms
. These models typically inherit from the
IShapeChanger
interface, and
should not be confused with transformers. They implement operations which
happen always after a model and make sense only if coupled with a model.
Sometimes they also depend on the pre-processing placed before the model.
How do I create a transformer with anomalearn?
anomalearn transformers are objects which transform data without changing
the shape of data, e.g.
anomalearn.algorithms.transformers.MinMaxScaler
. These objects
inherit from ITransformer
.
What is the difference between pre-, post-processing and transformers?
The first difference between processing and transformer objects is that the latter does not change the shape of the data in input. The former type of object explicitly changes the shape of the objects in input. However, both processing and transformer objects manipulate data. The difference between pre- and post- processing objects is that the former always happens before the model, the latter always happens after the model.
How do I create a pipeline with anomalearn?
anomalearn contains the implementation of a sequential pipeline which can
contain any sequence of objects following the layer interface. The
Pipeline
object can
be created with a list of layers, and it is mutable. Any sequence of objects
whose input/output shape are coherent can be created, and pipelines are
layers themselves, i.e. a pipeline can contain another pipeline.
Has anomalearn any helper function?
Yes, anomalearn contains several helper functions for the purpose of development of its main features. The helper packages are:
anomalearn.utils
: contains functions to work with other objects, such asnumpy.ndarray
orpandas.DataFrame
.anomalearn.input_validation
: contains functions to validate the input to functions and methods.anomalearn.visualizer
: contains functions to plot time series and results of detections.anomalearn.exceptions
: contains detailed exceptions with configurable messages to give detailed information regarding the error that occurred.