Center() public static method

Centers column data, subtracting the empirical mean from each variable.
public static Center ( this matrix, bool inPlace = false ) : ].double[
matrix this A matrix where each column represent a variable and each row represent a observation.
inPlace bool True to perform the operation in place, altering the original input matrix.
return ].double[
        public void SimplsComputeTest()
        {
            double[,] inputs;
            double[,] outputs;

            var pls = CreateWineExample(out inputs, out outputs);

            MultivariateLinearRegression regression = pls.CreateRegression();


            // test factor proportions
            double[] expectedX = { 0.86, 0.12, 0.00, 0.86 };
            double[] actualX   = pls.Predictors.FactorProportions;
            Assert.IsTrue(expectedX.IsEqual(actualX, atol: 0.01));

            double[] expectedY = { 0.67, 0.13, 0.17, 0.00 };
            double[] actualY   = pls.Dependents.FactorProportions;
            Assert.IsTrue(expectedY.IsEqual(actualY, atol: 0.01));


            // Test Properties
            double[][] weights = pls.Weights;
            double[,] actual = pls.Predictors.Result;

            double[,] X0 = (double[, ])pls.Source.Clone(); Tools.Center(X0, inPlace: true);
            double[,] Y0 = (double[, ])pls.Output.Clone(); Tools.Center(Y0, inPlace: true);

            // XSCORES = X0*W
            double[][] expected = X0.Dot(weights);
            Assert.IsTrue(expected.IsEqual(actual, 0.01));
        }