metric
Computes various statistical metrics based on the specified metric name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metric_name
|
str
|
The name of the metric to compute. Options include 'mean', 'variance', 'entropy', 'skewness', etc. |
required |
x
|
Tensor
|
The input tensor. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The computed metric. |
Raises:
Type | Description |
---|---|
ValueError
|
If the metric name is not recognized or the input tensor is invalid. |
Source code in tinybig/koala/statistics/metric.py
Computes the mean of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The mean value. |
Source code in tinybig/koala/statistics/metric.py
Computes the mean along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. |
required |
dim
|
int
|
The dimension along which to compute the mean (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The mean values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the geometric mean of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. All elements must be positive. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The geometric mean value. |
Source code in tinybig/koala/statistics/metric.py
Computes the geometric mean along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. All elements must be positive. |
required |
dim
|
int
|
The dimension along which to compute the geometric mean (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The geometric mean values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the harmonic mean of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. All elements must be positive. |
required |
weights
|
Tensor
|
The weights for each element in |
None
|
Returns:
Type | Description |
---|---|
Tensor
|
The harmonic mean value. |
Source code in tinybig/koala/statistics/metric.py
Computes the harmonic mean along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. All elements must be positive. |
required |
weights
|
Tensor
|
The weights for each element in the specified dimension. |
None
|
dim
|
int
|
The dimension along which to compute the harmonic mean (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The harmonic mean values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the weighted mean of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. |
required |
weights
|
Tensor
|
The weights for each element in |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The weighted mean value. |
Source code in tinybig/koala/statistics/metric.py
Computes the weighted mean along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. |
required |
weights
|
Tensor
|
The weights for each element in the specified dimension. |
required |
dim
|
int
|
The dimension along which to compute the weighted mean (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The weighted mean values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the median of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The median value. |
Source code in tinybig/koala/statistics/metric.py
Computes the median along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. |
required |
dim
|
int
|
The dimension along which to compute the median (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The median values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the mode of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The mode value. |
Source code in tinybig/koala/statistics/metric.py
Computes the mode along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. |
required |
dim
|
int
|
The dimension along which to compute the mode (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The mode values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the standard deviation of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The standard deviation value. |
Source code in tinybig/koala/statistics/metric.py
Computes the standard deviation along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. |
required |
dim
|
int
|
The dimension along which to compute the standard deviation (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The standard deviation values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the entropy of a probability distribution represented by a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. Values must sum to 1. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The entropy value. |
Source code in tinybig/koala/statistics/metric.py
Computes the entropy along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. Values in each dimension must sum to 1. |
required |
dim
|
int
|
The dimension along which to compute the entropy (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The entropy values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the variance of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The variance value. |
Source code in tinybig/koala/statistics/metric.py
Computes the variance along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. |
required |
dim
|
int
|
The dimension along which to compute the variance (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The variance values along the specified dimension. |
Source code in tinybig/koala/statistics/metric.py
Computes the skewness of a 1D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 1D tensor. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The skewness value. |
Source code in tinybig/koala/statistics/metric.py
Computes the skewness along a specified dimension for a 2D tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input 2D tensor. |
required |
dim
|
int
|
The dimension along which to compute the skewness (0 or 1). |
1
|
Returns:
Type | Description |
---|---|
Tensor
|
The skewness values along the specified dimension. |