From b33038e3c82de20ea232cb002de9b1ee2477f2d4 Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Sat, 28 Mar 2026 02:23:12 +0100 Subject: [PATCH] feat: tipo datascience OutlierResult (sum) Tipo suma para clasificar datos como Normal u Outlier con z-score. Co-Authored-By: Claude Opus 4.6 (1M context) --- types/datascience/outlier_result.go | 20 ++++++++++++++++++++ types/datascience/outlier_result.md | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 types/datascience/outlier_result.go create mode 100644 types/datascience/outlier_result.md 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" +---