Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/11 15:51:55 (14 years ago)
Author:
gkronber
Message:

#1426 merged r5690 from data analysis refactoring branch (see #1418) into trunk to fix persistence problems of SVMs.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis

  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs

    r5445 r5692  
    3737  [Item("SupportVectorMachineModel", "Represents a support vector machine model.")]
    3838  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;
    46     }
    47     public SupportVectorMachineModel() : base() { }
    48 
    4939    private SVM.Model model;
    5040    /// <summary>
     
    7767    }
    7868
     69    public IEnumerable<double[]> SupportVectors {
     70      get {
     71        return from sv in Model.SupportVectors
     72               select (from svx in sv
     73                       select svx.Value).ToArray();
     74      }
     75    }
     76
     77    [StorableConstructor]
     78    private SupportVectorMachineModel(bool deserializing) : base(deserializing) { }
     79    private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner)
     80      : base(original, cloner) {
     81      // only using a shallow copy here! (gkronber)
     82      this.model = original.model;
     83      this.rangeTransform = original.rangeTransform;
     84    }
     85    public SupportVectorMachineModel() : base() { }
     86
    7987    public IEnumerable<double> GetEstimatedValues(DataAnalysisProblemData problemData, int start, int end) {
    8088      SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(problemData, Enumerable.Range(start, end - start));
     
    96104
    97105    #region persistence
    98     [Storable]
    99     private int[] SupportVectorIndizes {
    100       get { return this.Model.SupportVectorIndizes; }
    101       set { this.Model.SupportVectorIndizes = value; }
    102     }
    103 
    104106    [Storable]
    105107    private string ModelAsString {
Note: See TracChangeset for help on using the changeset viewer.