Skip to main content
Skip table of contents

tw.anomaly_detection

The AnomalyDetection class provides a comprehensive set of tools for detecting anomalies in time-series data. It supports operations such as model building, anomaly detection, and root cause analysis (RCA). This class is designed to help users efficiently analyze data and identify unusual patterns or behaviors.


Class Initialization

PY
from tangent_works import TangentWorks

# Initialize the TangentWorks instance
tw = TangentWorks()

# Access the AnomalyDetectionAPI
tw.anomaly_detection

Methods

build_model

tw.anomaly_detection.build_model(configuration=Dict[str, Any], dataset=pd.DataFrame)

Builds an anomaly detection model using the provided configuration and dataset.

Parameters

  • configuration (Dict[str, Any]): The configuration parameters for model building.

  • dataset (pd.DataFrame): The time-series dataset used to train the model.

Returns

  • AnomalyDetectionModel: The constructed anomaly detection model.

Examples

PY
model = tw.anomaly_detection.build_model(
    configuration = config,
    dataset = data
)

detect

tw.anomaly_detection.detect(dataset=pd.DataFrame, model=AnomalyDetectionModel)

Detects anomalies in the provided dataset using the specified anomaly detection model.

Parameters

  • dataset (pd.DataFrame): The time-series dataset to analyze for anomalies.

  • model (AnomalyDetectionModel): The anomaly detection model to use.

Returns

  • pd.DataFrame: A DataFrame containing the detected anomalies.

Examples

PY
anomalies = tw.anomaly_detection.detect(
    dataset = data,
    model = model
)

rca

tw.anomaly_detection.rca(configuration=Dict[str, Any], dataset=pd.DataFrame, model=AnomalyDetectionModel)

Performs root cause analysis (RCA) to identify the causes of anomalies detected in the dataset.

Parameters

  • configuration (Dict[str, Any]): Configuration parameters for RCA.

  • dataset (pd.DataFrame): The time-series dataset to analyze for root causes.

  • model (AnomalyDetectionModel): The anomaly detection model to use for RCA.

Returns

  • Dict[int, pd.DataFrame]: A dictionary mapping root causes to their corresponding model indexes.

Examples

PY
rca_results = tw.anomaly_detection.rca(
    configuration = config,
    dataset = data,
    model = model
)

Key Features

  • Comprehensive Toolset: Supports anomaly detection, model building, and RCA.

  • Modular Design: Individual methods for building models, detecting anomalies, and analyzing root causes.

  • Scalable and Flexible: Works with various time-series datasets and configurations.


Dependencies

  • pandas: Used for handling time-series data.

  • Tangent Works core and business logic modules: Used for model building, validation, and anomaly detection.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.