Changeset 4722 for trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineCrossValidationEvaluator.cs
- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/CloningRefactoring (added) merged: 4656-4693,4696-4697,4711-4714,4718-4719
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis (added) merged: 4678,4682,4684,4697,4712
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineCrossValidationEvaluator.cs
r4543 r4722 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; 25 27 using HeuristicLab.Data; … … 29 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 32 using SVM; 31 using System.Collections.Generic;32 33 33 34 namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine { … … 126 127 #endregion 127 128 129 [StorableConstructor] 130 protected SupportVectorMachineCrossValidationEvaluator(bool deserializing) : base(deserializing) { } 131 132 protected SupportVectorMachineCrossValidationEvaluator(SupportVectorMachineCrossValidationEvaluator original, 133 Cloner cloner) 134 : base(original, cloner) { } 128 135 public SupportVectorMachineCrossValidationEvaluator() 129 136 : base() { … … 143 150 } 144 151 152 public override IDeepCloneable Clone(Cloner cloner) { 153 return new SupportVectorMachineCrossValidationEvaluator(this, cloner); 154 } 155 145 156 public override IOperation Apply() { 146 157 double reductionRatio = 1.0; // TODO: make parameter 147 158 if (ActualSamplesParameter.ActualValue != null) 148 159 reductionRatio = ActualSamplesParameter.ActualValue.Value; 149 IEnumerable<int> rows = 160 IEnumerable<int> rows = 150 161 Enumerable.Range(SamplesStart.Value, SamplesEnd.Value - SamplesStart.Value) 151 162 .Where(i => i < DataAnalysisProblemData.TestSamplesStart.Value || DataAnalysisProblemData.TestSamplesEnd.Value <= i); … … 153 164 // create a new DataAnalysisProblemData instance 154 165 DataAnalysisProblemData reducedProblemData = (DataAnalysisProblemData)DataAnalysisProblemData.Clone(); 155 reducedProblemData.Dataset = 166 reducedProblemData.Dataset = 156 167 CreateReducedDataset(RandomParameter.ActualValue, reducedProblemData.Dataset, rows, reductionRatio); 157 168 reducedProblemData.TrainingSamplesStart.Value = 0; … … 170 181 171 182 private Dataset CreateReducedDataset(IRandom random, Dataset dataset, IEnumerable<int> rowIndices, double reductionRatio) { 172 183 173 184 // must not make a fink: 174 185 // => select n rows randomly from start..end … … 191 202 // take the first n indexes (selected n rowIndexes from start..end) 192 203 // now order by index 193 int[] orderedRandomIndexes = 204 int[] orderedRandomIndexes = 194 205 rowIndexArr.Take(n) 195 206 .OrderBy(x => x)
Note: See TracChangeset
for help on using the changeset viewer.