Data Cleaning with PHP

Data Normalization with PHP-ML

Normalization in PHP-ML can be done manually or by looping through each feature. However, PHP-ML also includes some transformers, though they are more limited. Here’s an example of manual Min-Max normalization.

[100, 500, 25],
[150, 300, 15],
[200, 400, 20],
[50, 200, 10]
Result: Memory: 0.004 Mb Time running: < 0.001 sec.
Normalized Dataset:
---------------
Array
(
    [0] => Array
        (
            [0] => 0.33333333333333
            [1] => 1
            [2] => 1
        )

    [1] => Array
        (
            [0] => 0.66666666666667
            [1] => 0.33333333333333
            [2] => 0.33333333333333
        )

    [2] => Array
        (
            [0] => 1
            [1] => 0.66666666666667
            [2] => 0.66666666666667
        )

    [3] => Array
        (
            [0] => 0
            [1] => 0
            [2] => 0
        )

)