frlearn.array_functions.soft_max#
- frlearn.array_functions.soft_max(a, weights, k: int, axis=-1, type: str = 'arithmetic')#
Calculates the soft maximum 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 greatest values from which the soft maximum 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 maximum is calculated.
- typestr {‘arithmetic’, ‘geometric’, ‘harmonic’, }, default=’arithmetic’
Determines the type of weighted average.
- Returns:
- soft_max_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.