Kurbitz / PDCMAD

Creative Commons Attribution 4.0 International
3 stars 0 forks source link

Restructure the anomaly detection in detection.go to use an interface #112

Open Kurbitz opened 10 months ago

Kurbitz commented 10 months ago

Currently we have a map of strings to functions which take a specific parameter and return a specific output. Instead we could have an interface like this:

type AnomalyDetection interface{
    GetParameters() error
    Execute() (*[]system_metrics.AnomalyDetectionOutput, error)
}

type IsolationForest struct{
    Data system_metrics.SystemMetric
    Host string
    Duration string
}

func (i *IsolationForest) GetParameters() error{
    //...
}

func (i *IsolationForest) Execute() (*[]system_metrics.AnomalyDetectionOutput, error){
    //...
}

This way any AnomalyDetection could specify their own parameters without affecting other algorithms.

Kurbitz commented 10 months ago

Note: we don't actually have time to do this now. It's just a thing I would like to have done.