frlearn.array_functions.soft_head#
- frlearn.array_functions.soft_head(a, weights, k: int, axis=-1, type: str = 'arithmetic')#
Calculates the soft head of an array.
- Parameters:
- andarray
Input array of values.
- weights(k -> np.array) or None
Weights to apply to the
k
selected values. If None, thek
th value is returned.- k: int or None
Number of initial values from which the soft head is calculated. Should be either a positive integer not larger than
a
alongaxis
, or None, which is interpreted as the size ofa
alongaxis
.- axisint, default=-1
The axis along which the soft head is calculated.
- typestr {‘arithmetic’, ‘geometric’, ‘harmonic’, }, default=’arithmetic’
Determines the type of weighted average.
- Returns:
- soft_head_along_axisndarray
An array with the same shape as
a
, with the specified axis removed. Ifa
is a 0-d array, a scalar is returned.