Normalizes columns of the current matrix according to the specified mode.
MatrixObject.NormalizeColumns(NormalizeMode)
The following table describes the possible values for the NormalizeMode parameter.
| Constant | Description | Value |
|---|---|---|
| bmModeMaxOne | Normalizes columns so that the biggest element in each column is 1. | 1 |
| bmModeUnitLength | (Default) Normalizes columns so that they become unit length vectors (their sum of squares is 1). | 2 |
| bmModeZScores | Normalizes columns to z scores (having zero mean and unit standard deviation). | 3 |
Private Sub MatrixNormalizeColumns()
Dim A As Matrix, Norm As Double
Set A = New Matrix
A.Size 4, 4
A.FillRandom
Debug.Print "A ="
Debug.Print A.GetString
A.NormalizeColumns bmModeMaxOne
Debug.Print "NormalizeMode = bmModeMaxOne"
Debug.Print A.GetString
A.NormalizeColumns bmModeUnitLen
Debug.Print "NormalizeMode = bmModeUnitLength"
Debug.Print A.GetString
A.NormalizeColumns bmModeZScores
Debug.Print "NormalizeMode = bmModeZScores"
Debug.Print A.GetString
End Sub
A = | 6.000 2.000 8.000 6.000 | | 5.000 4.000 9.000 8.000 | | 7.000 2.000 9.000 7.000 | | 5.000 3.000 0.000 1.000 | NormalizeMode = bmModeMaxOne | 0.857 0.500 0.889 0.750 | | 0.714 1.000 1.000 1.000 | | 1.000 0.500 1.000 0.875 | | 0.714 0.750 0.000 0.125 | NormalizeMode = bmModeUnitLength | 0.516 0.348 0.532 0.490 | | 0.430 0.696 0.599 0.653 | | 0.602 0.348 0.599 0.572 | | 0.430 0.522 0.000 0.082 | NormalizeMode = bmModeZScores | 0.302 -0.905 0.397 0.186 | | -0.905 1.508 0.662 0.928 | | 1.508 -0.905 0.662 0.557 | | -0.905 0.302 -1.722 -1.671 |
Applies To: Matrix