- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 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) -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs
r4543 r4722 36 36 [StorableClass] 37 37 [Item("SupportVectorMachineModel", "Represents a support vector machine model.")] 38 public class SupportVectorMachineModel : NamedItem, IDataAnalysisModel { 39 public SupportVectorMachineModel() 40 : base() { 38 public sealed class SupportVectorMachineModel : NamedItem, IDataAnalysisModel { 39 [StorableConstructor] 40 private SupportVectorMachineModel(bool deserializing) : base(deserializing) { } 41 private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner) 42 : base(original, cloner) { 43 // only using a shallow copy here! (gkronber) 44 this.model = original.model; 45 this.rangeTransform = original.rangeTransform; 41 46 } 47 public SupportVectorMachineModel() : base() { } 42 48 43 49 private SVM.Model model; … … 131 137 132 138 public override IDeepCloneable Clone(Cloner cloner) { 133 SupportVectorMachineModel clone = (SupportVectorMachineModel)base.Clone(cloner); 134 // beware we are only using a shallow copy here! (gkronber) 135 clone.model = model; 136 clone.rangeTransform = rangeTransform; 137 return clone; 139 return new SupportVectorMachineModel(this, cloner); 138 140 } 139 141 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModelCreator.cs
r4543 r4722 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using HeuristicLab.Common; 23 26 using HeuristicLab.Core; 24 27 using HeuristicLab.Data; … … 27 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 31 using SVM; 29 using System.Collections.Generic;30 using System.Linq;31 32 32 33 namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine { … … 36 37 [StorableClass] 37 38 [Item("SupportVectorMachineModelCreator", "Represents an operator that creates a support vector machine model.")] 38 public class SupportVectorMachineModelCreator : SingleSuccessorOperator {39 public sealed class SupportVectorMachineModelCreator : SingleSuccessorOperator { 39 40 private const string DataAnalysisProblemDataParameterName = "DataAnalysisProblemData"; 40 41 private const string SvmTypeParameterName = "SvmType"; … … 110 111 #endregion 111 112 113 [StorableConstructor] 114 private SupportVectorMachineModelCreator(bool deserializing) : base(deserializing) { } 115 private SupportVectorMachineModelCreator(SupportVectorMachineModelCreator original, Cloner cloner) : base(original, cloner) { } 116 public override IDeepCloneable Clone(Cloner cloner) { 117 return new SupportVectorMachineModelCreator(this, cloner); 118 } 112 119 public SupportVectorMachineModelCreator() 113 120 : base() { … … 129 136 int start = SamplesStart.Value; 130 137 int end = SamplesEnd.Value; 131 IEnumerable<int> rows = 132 Enumerable.Range(start, end -start)138 IEnumerable<int> rows = 139 Enumerable.Range(start, end - start) 133 140 .Where(i => i < DataAnalysisProblemData.TestSamplesStart.Value || DataAnalysisProblemData.TestSamplesEnd.Value <= i); 134 141 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModelEvaluator.cs
r4543 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using System.Linq; 24 using HeuristicLab.Common; 22 25 using HeuristicLab.Core; 23 26 using HeuristicLab.Data; … … 26 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 30 using SVM; 28 using System.Collections.Generic;29 using System.Linq;30 31 31 32 namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine { … … 70 71 } 71 72 #endregion 73 74 [StorableConstructor] 75 protected SupportVectorMachineModelEvaluator(bool deserializing) : base(deserializing) { } 76 protected SupportVectorMachineModelEvaluator(SupportVectorMachineModelEvaluator original, Cloner cloner) : base(original, cloner) { } 77 public override IDeepCloneable Clone(Cloner cloner) { 78 return new SupportVectorMachineModelEvaluator(this, cloner); 79 } 72 80 public SupportVectorMachineModelEvaluator() 73 81 : base() {
Note: See TracChangeset
for help on using the changeset viewer.