---
library: "bootstrap"
slug: "Aggregate"
name: "Aggregate"
ref: "Aggregate#bb80"
hash: "sema:Aggregate#mh:SHA-256:bb809289d74615fd774f32704d3857a5e4d45480ad5b68de8f995e0c9e445d21"
type: "Primitives"
layer: "Infrastructure"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/Aggregate"
---

# Aggregate

Reduce a set to a summary statistic

Infrastructure · Primitives

## Mechanism

A deterministic function that maps a [Vector](https://semahash.org/vocabularies/bootstrap/patterns/Vector.md) of inputs to a single Scalar [Value](https://semahash.org/vocabularies/bootstrap/patterns/Value.md). Implements standard statistical operations (Mean, Mode, Median) to compress signal bandwidth. When the caller supplies [Vector](https://semahash.org/vocabularies/bootstrap/patterns/Vector.md) alongside the vector, the reduction becomes a weighted one. It serves as the computational backbone for consensus mechanisms.

## Invariants

- Determinism: F(Input) always yields the same Output.
- Yields one scalar [Value](https://semahash.org/vocabularies/bootstrap/patterns/Value.md) whatever the input length, including length one.

## Parameters

- function: type=Enum, range={Mean, Median, Mode, Sum, Min, Max, Variance, StdDev}, description=Default: Mean

## Preconditions

- All elements in list share a comparable type
- Input list is non-empty

## Postconditions

- Single summary value returned

## Failure modes

- Type Mismatch: Input list contains incomparable types (e.g., Integers mixed with Strings).
- Empty Set: Attempting to aggregate a list with length 0 (Undefined for Mean/[Mode](https://semahash.org/vocabularies/bootstrap/patterns/Mode.md)).
- Overflow: Sum of inputs exceeds maximum integer size (if strictly typed).

## Where this came from

—

## Builds on

- [Mode](https://semahash.org/vocabularies/bootstrap/patterns/Mode.md) (references)
- [Value](https://semahash.org/vocabularies/bootstrap/patterns/Value.md) (yields)
- [Vector](https://semahash.org/vocabularies/bootstrap/patterns/Vector.md) (accepts)

## Used by

- [ChunkMerge](https://semahash.org/vocabularies/bootstrap/patterns/ChunkMerge.md) (references)
- [DriftWatch](https://semahash.org/vocabularies/bootstrap/patterns/DriftWatch.md) (references)
- [Parallelize](https://semahash.org/vocabularies/bootstrap/patterns/Parallelize.md) (composes_with)
- [PerspectiveEnsemble](https://semahash.org/vocabularies/bootstrap/patterns/PerspectiveEnsemble.md) (references)
- [SelfConsistency](https://semahash.org/vocabularies/bootstrap/patterns/SelfConsistency.md) (references)
- [Vote](https://semahash.org/vocabularies/bootstrap/patterns/Vote.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: Aggregate#bb80
- Hash: sema:Aggregate#mh:SHA-256:bb809289d74615fd774f32704d3857a5e4d45480ad5b68de8f995e0c9e445d21

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/Aggregate
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/Aggregate.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
