Aggregation
Index
Mill.Aggregation
Mill.AggregationOperator
Mill.SegmentedLSE
Mill.SegmentedMax
Mill.SegmentedMean
Mill.SegmentedPNorm
Mill.SegmentedSum
Mill.lse_aggregation
Mill.max_aggregation
Mill.mean_aggregation
Mill.meanmax_aggregation
Mill.pnorm_aggregation
Mill.pnormlse_aggregation
Mill.sum_aggregation
API
Mill.AggregationOperator
— TypeAggregationOperator{T <: Number}
Supertype for any aggregation operator. T
is the type of parameters of the operator.
See also: Aggregation
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.Aggregation
— TypeAggregation{T, U <: Tuple{Vararg{AggregationOperator{T}}}}
A container that implements a concatenation of one or more AggregationOperator
s.
Construct with e.g. mean_aggregation([t::Type, ]d)
, max_aggregation([t::Type, ]d)
for single operators and with e.g. pnormlse_aggregation([t::Type, ]d)
for concatenations. With these calls all parameters inside operators are initialized randomly as Float32
arrays, unless type t
is further specified. It is also possible to call the constructor directly, see Examples.
Intended to be used as a functor:
(a::Aggregation)(x, bags[, w])
where x
is either Missing
, AbstractMatrix
or ArrayNode
, bags
is AbstractBags
structure and optionally w
is an AbstractVector
of weights.
If Mill.bagcount
is on, one more row is added to the result containing bag size after $x ↦ \log(x + 1)$ transformation.
Examples
julia> a = mean_aggregation(5)
Aggregation{Float32}:
SegmentedMean(ψ = Float32[0.0, 0.0, 0.0, 0.0, 0.0])
julia> a = meanmax_aggregation(Int64, 4)
Aggregation{Int64}:
SegmentedMean(ψ = [0, 0, 0, 0])
SegmentedMax(ψ = [0, 0, 0, 0])
julia> Aggregation(SegmentedMean(4), SegmentedMax(4))
Aggregation{Float32}:
SegmentedMean(ψ = Float32[0.0, 0.0, 0.0, 0.0])
SegmentedMax(ψ = Float32[0.0, 0.0, 0.0, 0.0])
julia> mean_aggregation(5)(Float32[0 1 2; 3 4 5], bags([1:1, 2:3]))
3×2 Array{Float32,2}:
0.0 1.5
3.0 4.5
0.693147 1.09861
See also: AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.SegmentedSum
— TypeSegmentedSum{T, V <: AbstractVector{T}} <: AggregationOperator{T}
AggregationOperator
implementing segmented sum aggregation:
$f(\{x_1, \ldots, x_k\}) = \sum_{i = 1}^{k} x_i$
Stores a vector of parameters ψ
that are filled into the resulting matrix in case an empty bag is encountered.
The direct use of the operator is discouraged, use Aggregation
wrapper instead. In other words, get this operator with sum_aggregation
instead of calling the SegmentedSum
constructor directly.
See also: AggregationOperator
, Aggregation
, sum_aggregation
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.SegmentedMax
— TypeSegmentedMax{T, V <: AbstractVector{T}} <: AggregationOperator{T}
AggregationOperator
implementing segmented max aggregation:
$f(\{x_1, \ldots, x_k\}) = \max_{i = 1, \ldots, k} x_i$
Stores a vector of parameters ψ
that are filled into the resulting matrix in case an empty bag is encountered.
The direct use of the operator is discouraged, use Aggregation
wrapper instead. In other words, get this operator with max_aggregation
instead of calling the SegmentedMax
constructor directly.
See also: AggregationOperator
, Aggregation
, max_aggregation
, SegmentedMean
, SegmentedSum
, SegmentedPNorm
, SegmentedLSE
.
Mill.SegmentedMean
— TypeSegmentedMean{T, V <: AbstractVector{T}} <: AggregationOperator{T}
AggregationOperator
implementing segmented mean aggregation:
$f(\{x_1, \ldots, x_k\}) = \frac{1}{k} \sum_{i = 1}^{k} x_i$
Stores a vector of parameters ψ
that are filled into the resulting matrix in case an empty bag is encountered.
The direct use of the operator is discouraged, use Aggregation
wrapper instead. In other words, get this operator with mean_aggregation
instead of calling the SegmentedMean
constructor directly.
See also: AggregationOperator
, Aggregation
, mean_aggregation
, SegmentedMax
, SegmentedSum
, SegmentedPNorm
, SegmentedLSE
.
Mill.SegmentedPNorm
— TypeSegmentedPNorm{T, V <: AbstractVector{T}} <: AggregationOperator{T}
AggregationOperator
implementing segmented p-norm aggregation:
$f(\{x_1, \ldots, x_k\}; p, c) = \left(\frac{1}{k} \sum_{i = 1}^{k} \vert x_i - c \vert ^ {p} \right)^{\frac{1}{p}}$
Stores a vector of parameters ψ
that are filled into the resulting matrix in case an empty bag is encountered, and vectors of parameters p
and c
used during computation.
The direct use of the operator is discouraged, use Aggregation
wrapper instead. In other words, get this operator with pnorm_aggregation
instead of calling the SegmentedPNorm
constructor directly.
See also: AggregationOperator
, Aggregation
, pnorm_aggregation
, SegmentedMax
, SegmentedMean
, SegmentedSum
, SegmentedLSE
.
Mill.SegmentedLSE
— TypeSegmentedLSE{T, V <: AbstractVector{T}} <: AggregationOperator{T}
AggregationOperator
implementing segmented log-sum-exp (LSE) aggregation:
$f(\{x_1, \ldots, x_k\}; r) = \frac{1}{r}\log \left(\frac{1}{k} \sum_{i = 1}^{k} \exp({r\cdot x_i})\right)$
Stores a vector of parameters ψ
that are filled into the resulting matrix in case an empty bag is encountered, and a vector of parameters r
used during computation.
The direct use of the operator is discouraged, use Aggregation
wrapper instead. In other words, get this operator with lse_aggregation
instead of calling the SegmentedLSE
constructor directly.
See also: AggregationOperator
, Aggregation
, lse_aggregation
, SegmentedMax
, SegmentedMean
, SegmentedSum
, SegmentedPNorm
.
Mill.sum_aggregation
— Functionsum_aggregation([t::Type, ]d::Int)
Construct Aggregation
consisting of SegmentedSum
operator.
Examples
julia> sum_aggregation(4)
Aggregation{Float32}:
SegmentedSum(ψ = Float32[0.0, 0.0, 0.0, 0.0])
julia> sum_aggregation(Int64, 2)
Aggregation{Int64}:
SegmentedSum(ψ = [0, 0])
See also: Aggregation
, AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.max_aggregation
— Functionmax_aggregation([t::Type, ]d::Int)
Construct Aggregation
consisting of SegmentedMax
operator.
Examples
julia> max_aggregation(4)
Aggregation{Float32}:
SegmentedMax(ψ = Float32[0.0, 0.0, 0.0, 0.0])
julia> max_aggregation(Int64, 2)
Aggregation{Int64}:
SegmentedMax(ψ = [0, 0])
See also: Aggregation
, AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.mean_aggregation
— Functionmean_aggregation([t::Type, ]d::Int)
Construct Aggregation
consisting of SegmentedMean
operator.
Examples
julia> mean_aggregation(4)
Aggregation{Float32}:
SegmentedMean(ψ = Float32[0.0, 0.0, 0.0, 0.0])
julia> mean_aggregation(Int64, 2)
Aggregation{Int64}:
SegmentedMean(ψ = [0, 0])
See also: Aggregation
, AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.pnorm_aggregation
— Functionpnorm_aggregation([t::Type, ]d::Int)
Construct Aggregation
consisting of SegmentedPNorm
operator.
See also: Aggregation
, AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.lse_aggregation
— Functionlse_aggregation([t::Type, ]d::Int)
Construct Aggregation
consisting of SegmentedLSE
operator.
See also: Aggregation
, AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.meanmax_aggregation
— Functionmeanmax_aggregation([t::Type, ]d::Int)
Construct Aggregation
consisting of SegmentedMean
and SegmentedMax
operators.
Examples
julia> meanmax_aggregation(4)
Aggregation{Float32}:
SegmentedMean(ψ = Float32[0.0, 0.0, 0.0, 0.0])
SegmentedMax(ψ = Float32[0.0, 0.0, 0.0, 0.0])
julia> meanmax_aggregation(Int64, 2)
Aggregation{Int64}:
SegmentedMean(ψ = [0, 0])
SegmentedMax(ψ = [0, 0])
See also: Aggregation
, AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.
Mill.pnormlse_aggregation
— Functionpnormlse_aggregation([t::Type, ]d::Int)
Construct Aggregation
consisting of SegmentedPNorm
and SegmentedLSE
operators.
See also: Aggregation
, AggregationOperator
, SegmentedSum
, SegmentedMax
, SegmentedMean
, SegmentedPNorm
, SegmentedLSE
.