Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/08/12 18:20:33 (12 years ago)
Author:
abeham
Message:

#1913: added quality output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/NCA/HeuristicLab.Algorithms.NCA/3.3/NCAModel.cs

    r8437 r8441  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Algorithms.DataAnalysis;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    6364      get { return (double[,])transformedTrainingset.Clone(); }
    6465    }
     66    [Storable]
     67    private Scaling scaling;
    6568
    6669    [StorableConstructor]
     
    7780      if (original.transformedTrainingset != null)
    7881        this.transformedTrainingset = (double[,])original.transformedTrainingset.Clone();
     82      this.scaling = cloner.Clone(original.scaling);
    7983    }
    80     public NCAModel(double[,] transformedTrainingset, double[,] transformationMatrix, int k, string targetVariable, IEnumerable<string> allowedInputVariables, double[] classValues = null)
     84    public NCAModel(double[,] transformedTrainingset, Scaling scaling, double[,] transformationMatrix, int k, string targetVariable, IEnumerable<string> allowedInputVariables, double[] classValues = null)
    8185      : base() {
    8286      this.name = ItemName;
    8387      this.description = ItemDescription;
    8488      this.transformedTrainingset = transformedTrainingset;
     89      this.scaling = scaling;
    8590      this.transformationMatrix = transformationMatrix;
    8691      this.k = k;
     
    96101
    97102    public IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) {
    98       int k = Math.Min(this.k, transformedTrainingset.GetLength(0));
    99       double[] transformedRow = new double[transformationMatrix.GetLength(1)];
     103      var k = Math.Min(this.k, transformedTrainingset.GetLength(0));
     104      var transformedRow = new double[transformationMatrix.GetLength(1)];
    100105      var kVotes = new SortedList<double, double>(k + 1);
    101106      foreach (var r in rows) {
     
    103108        int j = 0;
    104109        foreach (var v in allowedInputVariables) {
     110          var values = scaling.GetScaledValues(dataset, v, rows);
    105111          double val = dataset.GetDoubleValue(v, r);
    106112          for (int i = 0; i < transformedRow.Length; i++)
Note: See TracChangeset for help on using the changeset viewer.