Changeset 5882 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationAnalyzer.cs
- Timestamp:
- 03/30/11 13:14:12 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationAnalyzer.cs
r5809 r5882 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 25 26 using HeuristicLab.Parameters; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System.Collections.Generic; 29 using System; 30 using HeuristicLab.Random; 27 31 28 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 35 39 where T : class, ISymbolicDataAnalysisMultiObjectiveEvaluator<U> 36 40 where U : class, IDataAnalysisProblemData { 41 private const string RandomParameterName = "Random"; 37 42 private const string ProblemDataParameterName = "ProblemData"; 38 43 private const string EvaluatorParameterName = "Evaluator"; … … 42 47 43 48 #region parameter properties 49 public ILookupParameter<IRandom> RandomParameter { 50 get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; } 51 } 44 52 public ILookupParameter<U> ProblemDataParameter { 45 53 get { return (ILookupParameter<U>)Parameters[ProblemDataParameterName]; } … … 72 80 Parameters.Add(new ValueLookupParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index.")); 73 81 } 82 83 protected IEnumerable<int> GenerateRowsToEvaluate() { 84 int seed = RandomParameter.ActualValue.Next(); 85 int samplesStart = ValidationPartitionParameter.ActualValue.Start; 86 int samplesEnd = ValidationPartitionParameter.ActualValue.End; 87 int testPartitionStart = ProblemDataParameter.ActualValue.TestPartition.Start; 88 int testPartitionEnd = ProblemDataParameter.ActualValue.TestPartition.End; 89 90 if (samplesEnd < samplesStart) throw new ArgumentException("Start value is larger than end value."); 91 int count = (int)((samplesEnd - samplesStart) * RelativeNumberOfEvaluatedSamplesParameter.ActualValue.Value); 92 if (count == 0) count = 1; 93 return RandomEnumerable.SampleRandomNumbers(seed, samplesStart, samplesEnd, count) 94 .Where(i => i < testPartitionStart || testPartitionEnd <= i); 95 } 74 96 } 75 97 }
Note: See TracChangeset
for help on using the changeset viewer.