deeptrack.statistics Module#
Contains features that perform some statistics operation on the input.
These features reduce some dimension of the input by applying a statistical operation (sum, mean, etc.). They follow the syntax of the equivalent numpy function, meaning that ‘axis’ and ‘keepdims’ are valid arguments. Moreover, they all accept the distributed keyword, which determines if each image in the input list should be handled individually or not.
Module Structure#
Classes:
- Reducer: Base class for features that reduce input dimensionality using a
statistical function.
Sum: Computes the sum along the specified axis.
Prod: Computes the product along the specified axis.
Mean: Computes the arithmetic mean along the specified axis.
Median: Computes the median along the specified axis.
Std: Computes the standard deviation along the specified axis.
Variance: Computes the variance along the specified axis.
Cumsum: Computes the cumulative sum along the specified axis.
Min: Computes the minimum value along the specified axis.
Max: Computes the maximum value along the specified axis.
PeakToPeak: Computes the range (max - min) along the specified axis.
Quantile: Computes the q-th quantile along the specified axis.
Percentile: Computes the q-th percentile along the specified axis.
Example#
Reduce input dimensions using the Sum operation, with ‘distributed’ set to True:
>>> import numpy as np
>>> from deeptrack import statistics
>>> input_values = [np.ones((2,)), np.zeros((2,))]
>>> sum_operation = statistics.Sum(axis=0, distributed=True)
>>> sum_result = sum_operation(input_values)
>>> print(sum_result) # Output: [2, 0]
Reduce input dimensions using the Sum operation, with ‘distributed’ set to False:
>>> sum_operation = statistics.Sum(axis=0, distributed=False)
>>> sum_result = sum_operation(input_values)
>>> print(sum_result) # Output: [1, 1]
Reduce input dimensions using the Mean operation:
>>> mean_operation = statistics.Mean(axis=0, distributed=True)
>>> mean_result = mean_operation(input_values)
>>> print(mean_result) # Output: [1, 0]
Reducers can be added to the pipeline in two ways:
>>> summed_pipeline = some_pipeline_of_features >> Sum(axis=0)
>>> summed_pipeline = Sum(some_pipeline_of_features, axis=0)
Combining the two ways is not supported, and the behaviour is not guaranteed. For example:
>>> incorrectly_summed_pipline = some_feature >> Sum(
>>> some_pipeline_of_features, axis=0
>>> )
However, other operators can be used in this way:
>>> correctly_summed_and_subtracted_pipline = some_feature - Sum(
>>> some_pipeline_of_features, axis=0
>>> )
Classes#
|
Compute the cummulative sum along the specified axis. |
|
Base feature class. |
|
Wrapper for array-like values with property tracking. |
|
Return the maximum of an array or maximum along an axis. |
|
Compute the arithmetic mean along the specified axis. |
|
Compute the median along the specified axis. |
|
Return the minimum of an array or minimum along an axis. |
|
Range of values (maximum - minimum) along an axis. |
|
Compute the q-th percentile of the data along the specified axis. |
|
Compute the product along the specified axis |
|
Compute the q-th quantile of the data along the specified axis. |
|
Base class of features that reduce the dimensionality of the input. |
|
Compute the standard deviation along the specified axis. |
|
Compute the sum along the specified axis |
|
Compute the variance along the specified axis. |