[Python] Anomaly detection using ADTK

Discussão em 'Python' iniciado por Stack, Setembro 9, 2025.

  1. Stack

    Stack Membro Participativo

    i want to carry out an anomaly detection model for a simple dataset but it keeps giving me an error. the image shows the error

    below is the python code i used

    import pandas as pd
    import matplotlib.pyplot as plt
    import numpy as np

    #Importing the Anomaly Detection Toolkit
    from adtk.data import validate_series
    from adtk.visualization import plot
    from adtk.detector import ThresholdAD

    data = pd.read_csv('space_weather_unified.csv')
    data["event_type"] = pd.to_datetime(data["event_type"])
    data = data.set_index("event_type")
    data = data['kp_index'].fillna(0.00)
    data = data.astype(float)


    threshold_detector = ThresholdAD(high=3.0)
    anomalies = threshold_detector.detect(data)
    plot(data, anomaly=anomalies, anomaly_color='red', anomaly_tag="marker")
    plt.show()

    Continue reading...

Compartilhe esta Página