diff --git a/types/datascience/outlier_result.go b/types/datascience/outlier_result.go new file mode 100644 index 00000000..1c8d5d79 --- /dev/null +++ b/types/datascience/outlier_result.go @@ -0,0 +1,20 @@ +package datascience + +// OutlierResult is a sum type representing whether a data point is normal or an outlier. +type OutlierResult interface{ outlierResult() } + +// Normal indicates the data point is within expected range. +type Normal struct { + Index int + Value float64 +} + +// Outlier indicates the data point is anomalous. +type Outlier struct { + Index int + Value float64 + ZScore float64 +} + +func (Normal) outlierResult() {} +func (Outlier) outlierResult() {} diff --git a/types/datascience/outlier_result.md b/types/datascience/outlier_result.md new file mode 100644 index 00000000..e414449e --- /dev/null +++ b/types/datascience/outlier_result.md @@ -0,0 +1,15 @@ +--- +name: outlier_result +lang: go +domain: datascience +version: "1.0.0" +algebraic: sum +definition: | + type OutlierResult interface{ outlierResult() } + type Normal struct { Index int; Value float64 } + type Outlier struct { Index int; Value float64; ZScore float64 } +description: "Tipo suma que clasifica un dato como Normal o Outlier con su z-score. Usado por DetectOutliers." +tags: [datascience, outlier, anomaly, statistics] +uses_types: [] +file_path: "types/datascience/outlier_result.go" +---