public void PerfectFitTest() { double[,] features = { { 1d, 0d }, { 1d, 1d }, { 1d, 2d }, { 1d, 3d }, { 1d, 4d } }; double[] theta = { 1d, -1d }; double[] labels = { 1d, 0d, -1d, -2d, -3d }; Assert.AreEqual(0d, LinearRegression.Cost(features, labels, theta), 0.001d); Assert.AreEqual(0d, LinearRegression.Gradient(features, labels, theta).Sum(), 0.001d); }