Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5659 for branches


Ignore:
Timestamp:
03/10/11 12:39:21 (14 years ago)
Author:
gkronber
Message:

#1418 fixed bugs in CrossValidation

File:
1 edited

Legend:

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

    r5617 r5659  
    105105          throw new InvalidOperationException("Changing the algorithm is only allowed if the CrossValidation is stopped or prepared.");
    106106        if (algorithm != value) {
    107           if (value != null && value.Problem != null && !(value.Problem is IDataAnalysisProblem<IDataAnalysisProblemData>))
     107          if (value != null && value.Problem != null && !(value.Problem is IDataAnalysisProblem))
    108108            throw new ArgumentException("Only algorithms with a DataAnalysisProblem could be used for the cross validation.");
    109109          if (algorithm != null) DeregisterAlgorithmEvents();
     
    126126
    127127    [Storable]
    128     private IDataAnalysisProblem<IDataAnalysisProblemData> problem;
    129     public IDataAnalysisProblem<IDataAnalysisProblemData> Problem {
     128    private IDataAnalysisProblem problem;
     129    public IDataAnalysisProblem Problem {
    130130      get {
    131131        if (algorithm == null)
    132132          return null;
    133         return (IDataAnalysisProblem<IDataAnalysisProblemData>)algorithm.Problem;
     133        return (IDataAnalysisProblem)algorithm.Problem;
    134134      }
    135135      set {
     
    147147        if (value != null && !ProblemType.IsInstanceOfType(value))
    148148          throw new ArgumentException("Only DataAnalysisProblems could be used for the cross validation.");
    149         Problem = (IDataAnalysisProblem<IDataAnalysisProblemData>)value;
     149        Problem = (IDataAnalysisProblem)value;
    150150      }
    151151    }
    152152    public Type ProblemType {
    153       get { return typeof(IDataAnalysisProblem<IDataAnalysisProblemData>); }
     153      get { return typeof(IDataAnalysisProblem); }
    154154    }
    155155
     
    270270            IAlgorithm clonedAlgorithm = (IAlgorithm)algorithm.Clone();
    271271            clonedAlgorithm.Name = algorithm.Name + " Fold " + i;
    272             IDataAnalysisProblem<IDataAnalysisProblemData> problem = clonedAlgorithm.Problem as IDataAnalysisProblem<IDataAnalysisProblemData>;
     272            IDataAnalysisProblem problem = clonedAlgorithm.Problem as IDataAnalysisProblem;
    273273            problem.ProblemData.TestPartitionEnd.Value = (i + 1) == Folds.Value ? SamplesEnd.Value : (i + 1) * testSamplesCount + SamplesStart.Value;
    274274            problem.ProblemData.TestPartitionStart.Value = (i * testSamplesCount) + SamplesStart.Value;
     
    431431    }
    432432    private void Algorithm_ProblemChanged(object sender, EventArgs e) {
    433       if (algorithm.Problem != null && !(algorithm.Problem is IDataAnalysisProblem<IDataAnalysisProblemData>)) {
     433      if (algorithm.Problem != null && !(algorithm.Problem is IDataAnalysisProblem)) {
    434434        algorithm.Problem = problem;
    435435        throw new ArgumentException("A cross validation algorithm can only contain DataAnalysisProblems.");
    436436      }
    437       problem = (IDataAnalysisProblem<IDataAnalysisProblemData>)algorithm.Problem;
     437      problem = (IDataAnalysisProblem)algorithm.Problem;
    438438      OnProblemChanged();
    439439    }
Note: See TracChangeset for help on using the changeset viewer.