Changeset 5275 for branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs
- Timestamp:
- 01/11/11 15:03:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs
r4068 r5275 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; … … 72 78 73 79 public IEnumerable<double> GetEstimatedValues(DataAnalysisProblemData problemData, int start, int end) { 74 SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(problemData, start, end);80 SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(problemData, Enumerable.Range(start, end - start)); 75 81 SVM.Problem scaledProblem = Scaling.Scale(RangeTransform, problem); 76 82 77 83 return (from row in Enumerable.Range(0, scaledProblem.Count) 78 select SVM.Prediction.Predict(Model, scaledProblem.X[row])).ToList(); 84 select SVM.Prediction.Predict(Model, scaledProblem.X[row])) 85 .ToList(); 79 86 } 80 87 … … 130 137 131 138 public override IDeepCloneable Clone(Cloner cloner) { 132 SupportVectorMachineModel clone = (SupportVectorMachineModel)base.Clone(cloner); 133 // beware we are only using a shallow copy here! (gkronber) 134 clone.model = model; 135 clone.rangeTransform = rangeTransform; 136 return clone; 139 return new SupportVectorMachineModel(this, cloner); 137 140 } 138 141
Note: See TracChangeset
for help on using the changeset viewer.