Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/11 15:03:46 (14 years ago)
Author:
gkronber
Message:

Merged changes from trunk to data analysis exploration branch and added fractional distance metric evaluator. #1142

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs

    r4068 r5275  
    3636  [StorableClass]
    3737  [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;
    4146    }
     47    public SupportVectorMachineModel() : base() { }
    4248
    4349    private SVM.Model model;
     
    7278
    7379    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));
    7581      SVM.Problem scaledProblem = Scaling.Scale(RangeTransform, problem);
    7682
    7783      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();
    7986    }
    8087
     
    130137
    131138    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);
    137140    }
    138141
Note: See TracChangeset for help on using the changeset viewer.