Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/20/10 16:47:12 (15 years ago)
Author:
mkommend
Message:

added calculation and view for support vectors (ticket #1009)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs

    r3842 r3858  
    4949    }
    5050
    51     [Storable]
    52     private List<string> inputVariables;
     51    public Dataset SupportVectors {
     52      get { return CalculateSupportVectors(); }
     53    }
    5354
    5455    public SupportVectorRegressionSolution() : base() { }
     
    5657      : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
    5758      this.model = model;
    58       this.inputVariables = new List<string>(inputVariables);
    5959    }
    6060
    6161    protected override void OnProblemDataChanged(EventArgs e) {
    6262      RecalculateEstimatedValues();
     63      model.Model.SupportVectorIndizes = new int[0];
     64    }
     65
     66    private Dataset CalculateSupportVectors() {
     67      if (model.Model.SupportVectorIndizes.Length == 0)
     68        return new Dataset();
     69
     70      Dataset dataset = new Dataset(ProblemData.Dataset.VariableNames, new double[model.Model.SupportVectorCount, ProblemData.Dataset.Columns]);
     71      for (int i = 0; i < model.Model.SupportVectorIndizes.Length; i++) {
     72        for (int column = 0; column < ProblemData.Dataset.Columns; column++)
     73          dataset[i, column] = ProblemData.Dataset[model.Model.SupportVectorIndizes[i], column];
     74      }
     75      return dataset;
    6376    }
    6477
Note: See TracChangeset for help on using the changeset viewer.