Ejemplo n.º 1
0
        public override IRegressionModel Build(IRegressionProblemData pd, IRandom random, CancellationToken cancellationToken, out int numberOfParameters)
        {
            if (pd.Dataset.Rows < MinLeafSize(pd))
            {
                throw new ArgumentException("The number of training instances is too small to create a linear model");
            }
            numberOfParameters = pd.AllowedInputVariables.Count() + 1;

            double x1, x2;
            var    coeffs = ElasticNetLinearRegression.CalculateModelCoefficients(pd, 1, 0.2, out x1, out x2);

            numberOfParameters = coeffs.Length;
            return(ElasticNetLinearRegression.CreateSymbolicSolution(coeffs, pd).Model);
        }