Example #1
0
 protected DampenedModel(DampenedModel original, Cloner cloner) : base(original, cloner)
 {
     Model     = cloner.Clone(original.Model);
     Min       = original.Min;
     Max       = original.Max;
     Dampening = original.Dampening;
 }
Example #2
0
        public IRegressionModel BuildModel(IReadOnlyList <int> rows, RegressionTreeParameters parameters, CancellationToken cancellation, out int numberOfParameters)
        {
            var reducedData = RegressionTreeUtilities.ReduceDataset(parameters.Data, rows, parameters.AllowedInputVariables.ToArray(), parameters.TargetVariable);
            var pd          = new RegressionProblemData(reducedData, parameters.AllowedInputVariables.ToArray(), parameters.TargetVariable);

            pd.TrainingPartition.Start = 0;
            pd.TrainingPartition.End   = pd.TestPartition.Start = pd.TestPartition.End = reducedData.Rows;

            int numP;
            var model = Build(pd, parameters.Random, cancellation, out numP);

            if (UseDampening && Dampening > 0.0)
            {
                model = DampenedModel.DampenModel(model, pd, Dampening);
            }

            numberOfParameters = numP;
            cancellation.ThrowIfCancellationRequested();
            return(model);
        }