Skip to content

← statistics package

Covariance

Compute the covariance matrix between all elements of a given axis, and average over another axis.

The result will be a new data packet where the axis to average over is removed from the data, and the axis between whose elements the covariance was computed is duplicated. For instance, for a segmented multi-channel time series with time (samples), space (channels), and instance (segments) axes, after applying this node between space, and averaged over time, the result will be a new chunk with space, space, and instance axes. More Info... Version 1.1.0

Ports/Properties

data

Data to process.

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

shrinkage

Shrinkage regularization parameter. This parameter (between 0 and 1) controls the amount of shrinkage regularization applied to the covariance matrix estimates. This can be useful when channels are linearly dependent, and in that case a small amount (e.g., 0.001) is enugh to prevent degenerate solutions. Larger values may be used to implement regularization in the context of a pipeline.

verbose name
Shrinkage Regularization Parameter
default value
0.0
port type
FloatPort
value type
float (can be None)

avg_axis

Axis to average over. After the average has been taken, this axis will drop out of the data.

verbose name
Average Over Axis
default value
time
port type
ComboPort
value type
str (can be None)

cov_axis

Axis between whose elements the covariance should be calculated. This axis will be duplicated in the data.

verbose name
Calculate Between Elements Of Axis
default value
space
port type
ComboPort
value type
str (can be None)

assume_zeromean

Assume that the data is already zero-mean. If so, the mean will not be subtracted by this node, which saves compute time. Data that has previously been high-pass filtered can often be treated as being zero-mean.

verbose name
Assume Zeromean
default value
True
port type
BoolPort
value type
bool (can be None)

unbiased_estimate

Use unbiased estimator. If enabled, this will normalize by N-1 instead of N (making it the best unbiased estimate). If disabled, it will be the second moment matrix. Note that the difference is usually negligible except when trying to match other covariance implementations (e.g., MATLAB(tm)) exactly.

verbose name
Unbiased Estimate
default value
False
port type
BoolPort
value type
bool (can be None)

backend

Compute backend to use. The cupy and torch backends can be faster on data with many channels (e.g., >500) and 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)

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)