Standardization
Standardization to z-scores
Standardization transforms a value into a z-score by subtracting the mean and dividing by the standard deviation.
This is especially useful when you want to compare how far a feature deviates from the average in units of standard deviation.
Example of code:
<?php
function standardize(float $value, float $mean, float $std): float {
if ($std == 0.0) {
return 0.0;
}
return ($value - $mean) / $std;
}