Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/17 15:48:20 (8 years ago)
Author:
gkronber
Message:

#2700 merged changesets from trunk to branch

Location:
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/TSNE/HeuristicLab.Algorithms.DataAnalysis

  • branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs

    r14558 r14836  
    3838  [StorableClass]
    3939  [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 125)]
    40   public class GradientBoostedTreesAlgorithm : BasicAlgorithm, IDataAnalysisAlgorithm<IRegressionProblem> {
    41     public override Type ProblemType
    42     {
    43       get { return typeof(IRegressionProblem); }
    44     }
    45     public new IRegressionProblem Problem
    46     {
    47       get { return (IRegressionProblem)base.Problem; }
    48       set { base.Problem = value; }
    49     }
    50     public override bool SupportsPause
    51     {
    52       get { return false; }
    53     }
    54 
     40  public class GradientBoostedTreesAlgorithm : FixedDataAnalysisAlgorithm<IRegressionProblem> {
    5541    #region ParameterNames
    5642    private const string IterationsParameterName = "Iterations";
     
    289275          var classificationProblemData = new ClassificationProblemData(problemData.Dataset,
    290276            problemData.AllowedInputVariables, problemData.TargetVariable, problemData.Transformations);
    291           classificationModel.RecalculateModelParameters(classificationProblemData, classificationProblemData.TrainingIndices);
     277          classificationProblemData.TrainingPartition.Start = Problem.ProblemData.TrainingPartition.Start;
     278          classificationProblemData.TrainingPartition.End = Problem.ProblemData.TrainingPartition.End;
     279          classificationProblemData.TestPartition.Start = Problem.ProblemData.TestPartition.Start;
     280          classificationProblemData.TestPartition.End = Problem.ProblemData.TestPartition.End;
     281
     282          classificationModel.SetThresholdsAndClassValues(new double[] { double.NegativeInfinity, 0.0 }, new []{ 0.0, 1.0 });
     283
    292284
    293285          var classificationSolution = new DiscriminantFunctionClassificationSolution(classificationModel, classificationProblemData);
  • branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithmStatic.cs

    r14185 r14836  
    148148    // for custom stepping & termination
    149149    public static IGbmState CreateGbmState(IRegressionProblemData problemData, ILossFunction lossFunction, uint randSeed, int maxSize = 3, double r = 0.66, double m = 0.5, double nu = 0.01) {
     150      // check input variables. Only double variables are allowed.
     151      var invalidInputs =
     152        problemData.AllowedInputVariables.Where(name => !problemData.Dataset.VariableHasType<double>(name));
     153      if (invalidInputs.Any())
     154        throw new NotSupportedException("Gradient tree boosting only supports real-valued variables. Unsupported inputs: " + string.Join(", ", invalidInputs));
     155
    150156      return new GbmState(problemData, lossFunction, randSeed, maxSize, r, m, nu);
    151157    }
Note: See TracChangeset for help on using the changeset viewer.