예제 #1
0
        /// <summary>
        ///   Creates a new linear regression directly from data points.
        /// </summary>
        ///
        /// <param name="x">The input vectors <c>x</c>.</param>
        /// <param name="y">The output vectors <c>y</c>.</param>
        ///
        /// <returns>A linear regression f(x) that most approximates y.</returns>
        ///
        public static MultipleLinearRegression FromData(double[][] x, double[] y)
        {
            var regression = new MultipleLinearRegression(x[0].Length);

            regression.Regress(x, y);

            return(regression);
        }
예제 #2
0
 /// <summary>
 ///   Creates a new Simple Linear Regression of the form y = Ax + B.
 /// </summary>
 ///
 public SimpleLinearRegression()
 {
     this.regression = new MultipleLinearRegression(2);
 }
예제 #3
0
 /// <summary>
 ///   Creates a new Polynomial Linear Regression.
 /// </summary>
 ///
 /// <param name="degree">The degree of the polynomial used by the model.</param>
 ///
 public PolynomialRegression(int degree)
 {
     // degree plus the independent constant
     regression = new MultipleLinearRegression(degree + 1);
 }