Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/12/21 16:26:36 (4 years ago)
Author:
bburlacu
Message:

#3102: Add ClassificationProblemData constructor that explicitly takes class names and positive class value arguments, adapt code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r17824 r17835  
    521521      foreach (KeyValuePair<string, List<IClassificationSolution>> solutions in resultSolutions) {
    522522        // at least one algorithm (GBT with logistic regression loss) produces a classification solution even though the original problem is a regression problem.
    523         var targetVariable = solutions.Value.First().ProblemData.TargetVariable;
    524523        var dataset = (Dataset)Problem.ProblemData.Dataset;
    525524        if (ShuffleSamples.Value) {
     
    527526          dataset = dataset.Shuffle(random);
    528527        }
    529         var problemDataClone = new ClassificationProblemData(dataset, Problem.ProblemData.AllowedInputVariables, targetVariable);
     528        var problemData = (IClassificationProblemData)Problem.ProblemData;
     529        var problemDataClone = new ClassificationProblemData(dataset, problemData.AllowedInputVariables, problemData.TargetVariable, problemData.ClassNames, problemData.PositiveClass);
    530530        // set partitions of problem data clone correctly
    531531        problemDataClone.TrainingPartition.Start = SamplesStart.Value; problemDataClone.TrainingPartition.End = SamplesEnd.Value;
Note: See TracChangeset for help on using the changeset viewer.