Skip to main content

Anomaly detection

Train a detector and make threshold selection an explicit workflow decision.

PUBLISHED ON AKÔFLOW HUB

Explore this workflow and its measured results

The interactive DAG, version and execution summary below come directly from the public Hub publication.

Open full experiment ↗
Import this exact version and download the research data

In Desktop, choose Create workflow → Import from Hub and paste this immutable URI:

akoflow://hub/publications/43abd581-bea8-4067-97d6-b7db99b34374/versions/1

Run this example locally

Fit a Gaussian sensor baseline, score held-out normal and anomalous signals, select a threshold by measured F1, and publish the detected anomalies and calibration metrics.

Install Go and Python 3.12 or newer.

git clone https://github.com/UFFeScience/akoflow-examples.git &&
cd akoflow-examples &&
git checkout --detach showcase-hub-v1 &&
cd machine-learning/anomaly-detection &&
./prepare.sh &&
./run.sh

Run the block from the directory where you keep your repositories. If you already cloned the repository, enter this example's directory and run ./prepare.sh && ./run.sh.

Preparation downloads the Go module and any declared Python packages once. The workload then runs locally with offline input data. Every meaningful step is a separate process; independent activities run in parallel after their dependencies complete.

Read outputs/manifest.json for the generated artifacts, outputs/dag-validation.json for dependency waves, and outputs/stage-<activity>.json for each activity's observed result. A failed stage stops the run and prevents a successful final manifest.

Expected outputs: anomalies.json, metrics.json.

Run the same activities in Desktop

Start your local AkôFlow daemon with Docker available and configure AKOFLOW_API_TOKEN in your shell. From this example's directory, run:

go run ../../tools/daemon-local -root ../.. -example machine-learning/anomaly-detection

This command validates the daemon connection, builds the declared image, registers the local environment and workflow, and submits a real run. The daemon owns execution and file transfers. Open the printed run ID in Desktop to inspect each activity.

Anomaly detection. Nodes in the same column can run in parallel once their dependencies complete.

Activity responsibilities

ActivityResponsibility
collect-signalsExecute the collect-signals stage and publish its declared outputs for downstream activities.
build-featuresExecute the build-features stage and publish its declared outputs for downstream activities.
train-detectorExecute the train-detector stage and publish its declared outputs for downstream activities.
score-validationExecute the score-validation stage and publish its declared outputs for downstream activities.
choose-thresholdExecute the choose-threshold stage and publish its declared outputs for downstream activities.
publishExecute the publish stage and publish its declared outputs for downstream activities.

Inputs

  • Signal dataset
  • Feature specification
  • Operating-cost policy

Outputs

  • anomalies.json
  • metrics.json

Provenance to preserve

  • Time window
  • Feature code
  • Threshold rationale

Source bundle

The executable workflow and its implementation files are maintained in the separate AkôFlow examples repository. The documentation intentionally keeps code, container recipes, generators, and validation scripts out of the narrative page.

Open the complete source bundle ↗

Execution evidence

Latest validated Docker execution: 6 / 6 activities completed. Open the measured run, logs, metrics and output downloads in Hub. The documentation screenshots below are historical reference captures; they are separate from the latest Hub execution.

Read the historical documentation execution record · Local output manifest

Open full resolution ↗Anomaly detection: observed activity DAG
The reference activity graph from the documentation capture. Click to see the complete image.

Each stage also ran through the standalone local command. Read the dependency and artifact validation.

collect-signals

After: workflow start.

Open full resolution ↗Execution record for activity collect-signals

Read the measured local activity result

build-features

After: collect-signals.

Open full resolution ↗Execution record for activity build-features

Read the measured local activity result

train-detector

After: build-features.

Open full resolution ↗Execution record for activity train-detector

Read the measured local activity result

score-validation

After: train-detector.

Open full resolution ↗Execution record for activity score-validation

Read the measured local activity result

choose-threshold

After: score-validation.

Open full resolution ↗Execution record for activity choose-threshold

Read the measured local activity result

publish

After: choose-threshold.

Open full resolution ↗Execution record for activity publish

Read the measured local activity result

Execution considerations

Preserve time-based splits to prevent leakage. Feature construction may require more data movement than training.

AkôFlow boundary: the engine schedules, deploys, executes, transfers data, and records evidence. The ML or agent framework remains an implementation choice inside each activity.