- Timestamp:
- 03/10/11 12:39:21 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r5617 r5659 105 105 throw new InvalidOperationException("Changing the algorithm is only allowed if the CrossValidation is stopped or prepared."); 106 106 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)) 108 108 throw new ArgumentException("Only algorithms with a DataAnalysisProblem could be used for the cross validation."); 109 109 if (algorithm != null) DeregisterAlgorithmEvents(); … … 126 126 127 127 [Storable] 128 private IDataAnalysisProblem <IDataAnalysisProblemData>problem;129 public IDataAnalysisProblem <IDataAnalysisProblemData>Problem {128 private IDataAnalysisProblem problem; 129 public IDataAnalysisProblem Problem { 130 130 get { 131 131 if (algorithm == null) 132 132 return null; 133 return (IDataAnalysisProblem <IDataAnalysisProblemData>)algorithm.Problem;133 return (IDataAnalysisProblem)algorithm.Problem; 134 134 } 135 135 set { … … 147 147 if (value != null && !ProblemType.IsInstanceOfType(value)) 148 148 throw new ArgumentException("Only DataAnalysisProblems could be used for the cross validation."); 149 Problem = (IDataAnalysisProblem <IDataAnalysisProblemData>)value;149 Problem = (IDataAnalysisProblem)value; 150 150 } 151 151 } 152 152 public Type ProblemType { 153 get { return typeof(IDataAnalysisProblem <IDataAnalysisProblemData>); }153 get { return typeof(IDataAnalysisProblem); } 154 154 } 155 155 … … 270 270 IAlgorithm clonedAlgorithm = (IAlgorithm)algorithm.Clone(); 271 271 clonedAlgorithm.Name = algorithm.Name + " Fold " + i; 272 IDataAnalysisProblem <IDataAnalysisProblemData> problem = clonedAlgorithm.Problem as IDataAnalysisProblem<IDataAnalysisProblemData>;272 IDataAnalysisProblem problem = clonedAlgorithm.Problem as IDataAnalysisProblem; 273 273 problem.ProblemData.TestPartitionEnd.Value = (i + 1) == Folds.Value ? SamplesEnd.Value : (i + 1) * testSamplesCount + SamplesStart.Value; 274 274 problem.ProblemData.TestPartitionStart.Value = (i * testSamplesCount) + SamplesStart.Value; … … 431 431 } 432 432 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)) { 434 434 algorithm.Problem = problem; 435 435 throw new ArgumentException("A cross validation algorithm can only contain DataAnalysisProblems."); 436 436 } 437 problem = (IDataAnalysisProblem <IDataAnalysisProblemData>)algorithm.Problem;437 problem = (IDataAnalysisProblem)algorithm.Problem; 438 438 OnProblemChanged(); 439 439 }
Note: See TracChangeset
for help on using the changeset viewer.