class Aggregation(object): (source)
Known subclasses: fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.Distinct
, fiftyone.core.aggregations.FacetAggregations
, fiftyone.core.aggregations.HistogramValues
, fiftyone.core.aggregations.ListSchema
, fiftyone.core.aggregations.Max
, fiftyone.core.aggregations.Mean
, fiftyone.core.aggregations.Min
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Schema
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Sum
, fiftyone.core.aggregations.Values
Constructor: Aggregation(field_or_expr, expr, safe)
Abstract base class for all aggregations.
Aggregation
instances represent an aggregation or reduction
of a fiftyone.core.collections.SampleCollection
instance.
Parameters | |
field | a field name, embedded.field.name,
fiftyone.core.expressions.ViewExpression , or
MongoDB expression
defining the field or expression to aggregate |
expr | a fiftyone.core.expressions.ViewExpression or
MongoDB expression
to apply to field_or_expr (which must be a field) before
aggregating |
safe | whether to ignore nan/inf values when dealing with floating point values |
Method | __eq__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | default |
Returns the default result for this aggregation. |
Method | parse |
Parses the output of to_mongo . |
Method | to |
Returns the MongoDB aggregation pipeline for this aggregation. |
Property | expr |
The expression being computed, if any. |
Property | field |
The name of the field being computed on, if any. |
Property | safe |
Whether nan/inf values will be ignored when dealing with floating point values. |
Class Method | _from |
Creates an Aggregation instance from a serialized JSON dict representation of it. |
Method | _kwargs |
Returns a list of [name, value] lists describing the parameters of this aggregation instance. |
Method | _needs |
Whether the aggregation requires frame labels of video samples to be attached. |
Method | _needs |
Whether the aggregation requires group slice(s) to be attached. |
Method | _serialize |
Returns a JSON dict representation of the Aggregation . |
Instance Variable | _expr |
Undocumented |
Instance Variable | _field |
Undocumented |
Instance Variable | _safe |
Undocumented |
Instance Variable | _uuid |
Undocumented |
Property | _has |
Whether the aggregation's result is returned across multiple documents. |
Property | _is |
Whether the aggregation has big results and its pipeline is defined by a single $project stage and thus can be combined with other such aggregations. |
fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.Distinct
, fiftyone.core.aggregations.FacetAggregations
, fiftyone.core.aggregations.HistogramValues
, fiftyone.core.aggregations.ListSchema
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Schema
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Values
Undocumented
fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.Distinct
, fiftyone.core.aggregations.FacetAggregations
, fiftyone.core.aggregations.HistogramValues
, fiftyone.core.aggregations.ListSchema
, fiftyone.core.aggregations.Max
, fiftyone.core.aggregations.Mean
, fiftyone.core.aggregations.Min
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Schema
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Sum
, fiftyone.core.aggregations.Values
Returns the default result for this aggregation.
Default results are used when aggregations are applied to empty collections.
Returns | |
the aggregation result |
fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.Distinct
, fiftyone.core.aggregations.FacetAggregations
, fiftyone.core.aggregations.HistogramValues
, fiftyone.core.aggregations.ListSchema
, fiftyone.core.aggregations.Max
, fiftyone.core.aggregations.Mean
, fiftyone.core.aggregations.Min
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Schema
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Sum
, fiftyone.core.aggregations.Values
Parses the output of to_mongo
.
Parameters | |
d | the result dict, or, when _is_big_batchable is True, the
iterable of result dicts |
Returns | |
the aggregation result |
fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.Distinct
, fiftyone.core.aggregations.FacetAggregations
, fiftyone.core.aggregations.HistogramValues
, fiftyone.core.aggregations.ListSchema
, fiftyone.core.aggregations.Max
, fiftyone.core.aggregations.Mean
, fiftyone.core.aggregations.Min
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Schema
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Sum
, fiftyone.core.aggregations.Values
Returns the MongoDB aggregation pipeline for this aggregation.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the aggregation is being applied |
context:None | a path context from which to resolve |
Returns | |
a MongoDB aggregation pipeline (list of dicts) |
fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.Distinct
, fiftyone.core.aggregations.HistogramValues
, fiftyone.core.aggregations.ListSchema
, fiftyone.core.aggregations.Max
, fiftyone.core.aggregations.Mean
, fiftyone.core.aggregations.Min
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Schema
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Sum
, fiftyone.core.aggregations.Values
The expression being computed, if any.
fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.Distinct
, fiftyone.core.aggregations.Max
, fiftyone.core.aggregations.Mean
, fiftyone.core.aggregations.Min
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Sum
Whether nan/inf values will be ignored when dealing with floating point values.
Creates an Aggregation
instance from a serialized JSON dict
representation of it.
Parameters | |
d | a JSON dict |
Returns | |
an Aggregation |
fiftyone.core.aggregations.Bounds
, fiftyone.core.aggregations.Count
, fiftyone.core.aggregations.CountValues
, fiftyone.core.aggregations.FacetAggregations
, fiftyone.core.aggregations.HistogramValues
, fiftyone.core.aggregations.ListSchema
, fiftyone.core.aggregations.Quantiles
, fiftyone.core.aggregations.Schema
, fiftyone.core.aggregations.Std
, fiftyone.core.aggregations.Values
Returns a list of [name, value] lists describing the parameters of this aggregation instance.
Returns | |
a list of [name, value] lists |
Whether the aggregation requires frame labels of video samples to be attached.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the aggregation is being applied |
Returns | |
True/False |
Whether the aggregation requires group slice(s) to be attached.
Parameters | |
sample | the
fiftyone.core.collections.SampleCollection to which
the aggregation is being applied |
Returns | |
None, or a list of group slices |
fiftyone.core.aggregations.FacetAggregations
Returns a JSON dict representation of the Aggregation
.
Parameters | |
includeTrue | whether to include the aggregation's UUID in the JSON representation |
Returns | |
a JSON dict |
fiftyone.core.aggregations.Values
Whether the aggregation's result is returned across multiple documents.
This property affects the data passed to to_mongo
at runtime.
fiftyone.core.aggregations.Values
Whether the aggregation has big results and its pipeline is defined by a single $project stage and thus can be combined with other such aggregations.
Aggregation
classes for which _is_big_batchable
may be
True must accept an optional big_field parameter in their
to_mongo
method that specifies the field name to use in its
$project stage.