public void ExampleTest2()
{
// Suppose we would like to map the continuous values in the
// second column to the integer values in the first column.
var inputs = new[]
{
new[] { 1.0, 1.0, 1.0 },
new[] { 2.0, 4.0, 8.0 },
new[] { 3.0, 9.0, 27.0 },
new[] { 4.0, 16.0, 64.0 },
};
var ouputs = new[] { 0.73, 3.24, 8.31, 16.72 };
var regression = new MultipleLinearRegression(3);
var nnls = new NonNegativeLeastSquares(regression)
{
MaxIterations = 100
};
nnls.Run(inputs, ouputs);
Assert.AreEqual(0.1, nnls.Coefficients[0], 1e-3);
Assert.AreEqual(0.5, nnls.Coefficients[1], 1e-3);
Assert.AreEqual(0.13, nnls.Coefficients[2], 1e-3);
}