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

Weighted mean along axes; weights may be source-shaped or a flat reduced-slice vector.

Parameters
ParameterDescription
weightsFinite non-negative Double weights.
axisSelection of axes (axis accepts a single index).
keepDimsKeep reduced dimensions with length one.
resultOptional non-aliased, shape-compatible destination reused without allocation.
ignoreNaNSkip NaNs; otherwise propagate them.
whereOptional flat Boolean mask, one entry per source element.
Returns

Reduced Double tensor.

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, axis=1)