klyn.math.preprocessing.StandardScaler.transform
method
public transform(notnull data as NDArray<T>, inPlace as Boolean = false) as NDArray<T>
Description

Applies (x - trainingMean) / trainingScale using one fused buffer pass. Inputs and fitted statistics are never retained by the returned tensor. In-place operation validates all values before writing, without allocating a second full-size tensor. Device-backed inputs are synchronized to CPU.

Parameters
ParameterDescription
dataFinite matrix with the fitted feature count and dtype T.
inPlaceFalse returns an independent tensor; true modifies data.
Returns

New tensor, or exactly data when inPlace is true.

Throws
  • ValueException before fit, on shape mismatch, NaN/Inf or overflow.
  • NullException if data is null at runtime; statically null arguments are rejected with TypeError.
Example

scaled = scaler.transform(xTest)

assert scaler.transform(xTest, inPlace=true) is xTest