klyn.math.NDArray.mean
method
public mean(notnull weights as NDArray<Double>, ignoreNaN as Boolean = false, where as Boolean[] = null) as Double
Description

Weighted arithmetic mean of every selected element.

Parameters
ParameterDescription
weightsDouble tensor with the same shape; weights must be finite, non-negative and have positive sum.
ignoreNaNSkip NaNs; otherwise propagate them.
whereOptional flat Boolean mask, one entry per source element.
Returns

Scalar Double.

Throws
  • ValueException for invalid parameters or no selected observations.
  • NullException if weights is null at runtime; statically null arguments are rejected with TypeError.
Example

average = data.mean(weights=weights)