Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/04/13 15:16:49 (12 years ago)
Author:
abeham
Message:

#1913: removed scaling of data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Nca/NcaModel.cs

    r8528 r9272  
    3333
    3434    [Storable]
    35     private Scaling scaling;
    36     [Storable]
    3735    private double[,] transformationMatrix;
    3836    public double[,] TransformationMatrix {
     
    5250    protected NcaModel(NcaModel original, Cloner cloner)
    5351      : base(original, cloner) {
    54       this.scaling = cloner.Clone(original.scaling);
    5552      this.transformationMatrix = (double[,])original.transformationMatrix.Clone();
    5653      this.allowedInputVariables = (string[])original.allowedInputVariables.Clone();
     
    5956      this.classValues = (double[])original.classValues.Clone();
    6057    }
    61     public NcaModel(int k, double[,] transformationMatrix, Dataset dataset, IEnumerable<int> rows, string targetVariable, IEnumerable<string> allowedInputVariables, Scaling scaling, double[] classValues) {
     58    public NcaModel(int k, double[,] transformationMatrix, Dataset dataset, IEnumerable<int> rows, string targetVariable, IEnumerable<string> allowedInputVariables, double[] classValues) {
    6259      Name = ItemName;
    6360      Description = ItemDescription;
    64       this.scaling = scaling;
    6561      this.transformationMatrix = (double[,])transformationMatrix.Clone();
    6662      this.allowedInputVariables = allowedInputVariables.ToArray();
     
    9086
    9187    public double[,] Reduce(Dataset dataset, IEnumerable<int> rows) {
    92       var scaledData = AlglibUtil.PrepareAndScaleInputMatrix(dataset, allowedInputVariables, rows, scaling);
     88      var data = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables, rows);
     89
    9390      var targets = dataset.GetDoubleValues(targetVariable, rows).ToArray();
    94       var result = new double[scaledData.GetLength(0), transformationMatrix.GetLength(1) + 1];
    95       for (int i = 0; i < scaledData.GetLength(0); i++)
    96         for (int j = 0; j < scaledData.GetLength(1); j++) {
     91      var result = new double[data.GetLength(0), transformationMatrix.GetLength(1) + 1];
     92      for (int i = 0; i < data.GetLength(0); i++)
     93        for (int j = 0; j < data.GetLength(1); j++) {
    9794          for (int x = 0; x < transformationMatrix.GetLength(1); x++) {
    98             result[i, x] += scaledData[i, j] * transformationMatrix[j, x];
     95            result[i, x] += data[i, j] * transformationMatrix[j, x];
    9996          }
    10097          result[i, transformationMatrix.GetLength(1)] = targets[i];
Note: See TracChangeset for help on using the changeset viewer.