📅  最后修改于: 2023-12-03 15:15:50.520000             🧑  作者: Mango
insss
insss
is a Python package for detecting anomalous time series data using a variety of methods. It provides various algorithms for detecting anomalies in time series data, including statistical methods, machine learning approaches, and hybrid methods.
To install insss
, you can use pip:
pip install insss
To use insss
, you start by importing the desired detector:
from insss.detectors import ARIMADetector
Next, you create an instance of the chosen detector and fit it to your data:
detector = ARIMADetector()
detector.fit(train_data)
Finally, you can use the detector to make predictions on new data:
anomaly_scores = detector.predict(test_data)
Here's an example of how to use insss
to detect anomalies in a univariate time series:
from insss.detectors import ARIMADetector
from insss.utils import generate_synthetic_data, plot_anomalies
# Generate synthetic data for testing
data = generate_synthetic_data(period=50, n=1000, anomaly_ratio=0.05)
# Split data into train and test sets
train_data = data[:800]
test_data = data[800:]
# Fit an ARIMA detector to the training data
detector = ARIMADetector()
detector.fit(train_data)
# Predict anomalies in the test data
anomaly_scores = detector.predict(test_data)
# Plot the data with detected anomalies
plot_anomalies(test_data, anomaly_scores)
This will produce a plot showing the original time series data with the detected anomalies highlighted.
insss
provides a comprehensive set of tools for detecting anomalies in time series data. With its support for a variety of algorithms, easy-to-use API, and visualization tools, insss
is a great choice for anyone looking to find anomalous patterns in their data.