Skip to content

← statistics package

Centroid

Compute a (typically robust) centroid of the given data points enumerated by an axis.

The chosen axis will be removed from the data and replaced by a new one-element feature axis. In the special case that the mean is taken over time, frequency, or instances, a dummy time/frequency/instance axis will be retained, unless this behavior is overriden using the force feature axis parameter. This node behaves similarly to the mean and is equivalent for the axial and euclidean estimators (which are included for completeness). In contrast, the robust estimators are best interpreted as a point that lies in the center of the provided input data points according to some measure and is therefore a multi-variate solution. More Info... Version 1.0.0

Ports/Properties

data

Data to process.

  • verbose name: Data
  • default value: None
  • port type: DataPort
  • value type: AnyNumeric (can be None)
  • data direction: INOUT

axis

Axis along which to take the statistic. This axis will drop out of the data and, if keep_axis is set, is replaced by a dummy one-element axis (usually of same type as before, although special cases apply for specific reduction nodes). One may also list a comma-separated list of axes here to reduce over multiple axes at a time. If this is left blank or set to None, then all axes will be reduced over; this can be used to obtain a single value if keep_axis is also set to False. The tree axis is a special case that will reduce over the data structure itself (e.g., dictionary), and the streams axis will reduce over the streams in a packet.

  • verbose name: Act Along Axis
  • default value: instance
  • port type: ComboPort
  • value type: str (can be None)

axis_occurrence

Index of the occurrence of the axis of desired type. (0 is the first axis of the desired type, 1 is the second, -1 is the last, -2 is the second-to-last, and so on).

  • verbose name: Axis Occurrence
  • default value: 0
  • port type: IntPort
  • value type: int (can be None)

keep_axis

Keep the axis that was reduced as a singleton (one-element) axis in the data. In script usage this can also be set to None to reduce over and drop all axes and return a scalar value (in graph pipelines the same can be achieved by setting the axis to (all axes) and keep_axis to False).

  • verbose name: Keep Reduced Axis
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

kept_axis

New type of the axis that was reduced over, if the keep_axis (keep reduced axis) option is enabled. Setting this to the type of an axis (e.g., feature) will result in a one-element axis of that type in place of the original axis; the value 'same' will yield an axis of the same type as the original axis (and will also preserve the old axis' custom label, if any). The 'legacy' setting will preserve the type of some axes but generate a feature axes for others, and this is not consistent between e.g., Mean, Variance and other statistics (see the "force feature axis" option for full details). The default value will change from 'legacy' to 'same' in a future release. The 'legacy (warn)' setting is like 'legacy' but will additionally issue an actionable one-time warning in which way the node's behavior will transition to a more consitent mode, and how to preserve the current behavior. One may also specify other axis types here. Note that, while one may bake a desired axis label into the axis type here, it is considered bad practice to use the label to annotate the statistic used, especially if the axis should pair correctly with other axes of same type (but perhaps different label) in downstream operations. Use a feature, statistic, or named axis for this purpose, which will record the statistic in the (one-element) axis array instead.

  • verbose name: Axis If Kept
  • default value: legacy
  • port type: ComboPort
  • value type: str (can be None)

force_feature_axis

Deprecated option used in legacy pipelines. This field should be cleared in modern uses, in which case the kept_axis field takes precedence. Setting this to 'True' will always create a feature axis; setting it to 'False' will preserve the same axis type IF the legacy behavior of the node supported it, and otherwise creates a feature axis. Cases in which a feature axis was created if set to False are as follows: Variance, StandardDeviation, and CurveLength: space, frequency, instance, named, statistic, and axis were reduced to feature. Sum, MedianAbsoluteDeviation, Product, RootMeanSquare: space, named, statistic, and axis were reduced to feature. Mean: lag, named, statistic, and axis were reduced to feature. All, Any, Centroid, Largest, Smallest, Median: lag was reduced to feature.

  • verbose name: Force Feature Axis (Legacy)
  • default value: None
  • port type: Port
  • value type: object (can be None)

estimator

Type of estimator to use. The euclidean-mean the mean over the axis, which is also the point that minimizes the sum of squared distances to all data points (least-squares centroid); this is a non-robust estimator. The geometric_median estimates the point that minimizes the sum of (absolute) distances to the data points (aka l1 median), and is robust; however, similarly to the median, the value is determined by a small number of data points near the estimate, and may simply be the most central point. The huber_centroid can be viewed as a hybrid of euclidean mean and geometric median, and combines benefits of both (robust to outliers but leverges a large number of inliers to compute a point, aka high statistical efficiency). The axial estimators calculate each axis of the centroid separately and are therefore not rotationally invariant, and they may exhibit some other artifacts (e.g., centroids of covariance matrices do typically do not retain positive definiteness).

  • verbose name: Estimator
  • default value: geometric_median
  • port type: EnumPort
  • value type: str (can be None)

clustered

Optionally indices of channels that comprise clusters. For use with a clustered huber estimator.

  • verbose name: Clustered
  • default value: None
  • port type: DictPort
  • value type: dict (can be None)

cluster_fusion

How to tally the outlyingness of individual feature/channel clusters in a sample. Max will penalize data where even just a few feature clusters are bad, while sum will be relatively forgiving if only a few feature clusters are bad.

  • verbose name: Cluster Fusion
  • default value: max
  • port type: EnumPort
  • value type: str (can be None)

trim_proportion

Proportion to trim for axial_trim_mean estimator. Applied to both the smallest and largest values in the data (along each axis).

  • verbose name: Trim Proportion
  • default value: 0.1
  • port type: FloatPort
  • value type: float (can be None)

huber_cutoff

The number of (robust) standard deviations from the center at which to treat data poinst outliers. The default value yields 95% statistical efficiency if the data is a Gaussian contaminated by outliers.

  • verbose name: Huber Cutoff
  • default value: 1.345
  • port type: FloatPort
  • value type: float (can be None)

ignore_nans

Ignore NaN values. This is not currently supported for all types of estimators (errors will be thrown).

  • verbose name: Ignore Nan Values
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

backend

Compute backend to use. The cupy and torch backends can be as much as 10x faster on large problems if the system has a CUDA-capable GPU installed. Keep means to use whatever was used to create the incoming data.

  • verbose name: Backend
  • default value: keep
  • port type: EnumPort
  • value type: str (can be None)

precision

Numeric precision to use. Can be reduced to save memory (e.g. if running on GPU). Only needed for the largest of problems, and only used by the geometric and huber centroids.

  • verbose name: Precision
  • default value: keep
  • port type: EnumPort
  • value type: str (can be None)

relative_tolerance

Relative tolerance. Used by the geometric and huber estimators; if the estimate changed less than this relative to the current value, the stopping criterion is satisfied and the estimate is returned.

  • verbose name: Relative Tolerance
  • default value: 1e-05
  • port type: FloatPort
  • value type: float (can be None)

median_cachekey

Optionally a cache key used to cache the result of the initial guess (median). Can be used for the iterative estimators (geometric median, huber) to start from a common seed. This is only useful for extremely large (multi-gigabyte) input data where the median takes a significant fraction of the compute time.

  • verbose name: Median Cachekey
  • default value: None
  • port type: StringPort
  • value type: str (can be None)

max_iter

Maximum iterations. This only applies to the iterative procedures (e.g., huber, geometric median).

  • verbose name: Max Iter
  • default value: 20
  • port type: IntPort
  • value type: int (can be None)

verbose

Verbose output.

  • verbose name: Verbose
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)

recurse_lists

Whether to treat lists as a recursive data structure as opposed to a numeric array. When disabled, lists are treated like arrays; they are expected to contain numbers or regularly shaped sublists of numbers and are subject to the conventional broadcasting rules of arrays known from numpy and similar libraries. When this option is enabled, lists may instead contain non-numeric data structures such as packets, dictionaries, tuples, or lists of non-uniform shapes, and will in turn not be subject to normal array broadcasting rules. Processing lists of numbers this way involves more overhead than when this option is set to False. Note that dictionaries and tuples are always treated as recursive data structures by this node.

  • verbose name: Lists As Data Structure
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)