Пример #1
0
        public static double ComputeResidualSqSum(LinearRegression.LinearRegressionParameters Parameters, IEnumerable <PixelPoint> Points)
        {
            double Sum = 0;

            foreach (PixelPoint pp in Points)
            {
                double Est = Parameters.Slope * pp.X + Parameters.Intercept;
                Est -= pp.Y;
                Sum += Est * Est;
            }
            return(Sum);
        }
Пример #2
0
        public static double ComputeResidualSqSum(LinearRegression.LinearRegressionParameters Parameters, double[] X, double[] Y)
        {
            System.Diagnostics.Contracts.Contract.Requires(X.Length == Y.Length);
            double Sum = 0;

            for (int i = 0; i < X.Length; i++)
            {
                double Est = Parameters.Slope * X[i] + Parameters.Intercept;
                Est -= Y[i];
                Sum += Est * Est;
            }
            return(Sum);
        }