Changeset 8441 for branches/NCA/HeuristicLab.Algorithms.NCA/3.3/NCAModel.cs
- Timestamp:
- 08/08/12 18:20:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/NCA/HeuristicLab.Algorithms.NCA/3.3/NCAModel.cs
r8437 r8441 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Algorithms.DataAnalysis; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; … … 63 64 get { return (double[,])transformedTrainingset.Clone(); } 64 65 } 66 [Storable] 67 private Scaling scaling; 65 68 66 69 [StorableConstructor] … … 77 80 if (original.transformedTrainingset != null) 78 81 this.transformedTrainingset = (double[,])original.transformedTrainingset.Clone(); 82 this.scaling = cloner.Clone(original.scaling); 79 83 } 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) 81 85 : base() { 82 86 this.name = ItemName; 83 87 this.description = ItemDescription; 84 88 this.transformedTrainingset = transformedTrainingset; 89 this.scaling = scaling; 85 90 this.transformationMatrix = transformationMatrix; 86 91 this.k = k; … … 96 101 97 102 public IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) { 98 intk = 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)]; 100 105 var kVotes = new SortedList<double, double>(k + 1); 101 106 foreach (var r in rows) { … … 103 108 int j = 0; 104 109 foreach (var v in allowedInputVariables) { 110 var values = scaling.GetScaledValues(dataset, v, rows); 105 111 double val = dataset.GetDoubleValue(v, r); 106 112 for (int i = 0; i < transformedRow.Length; i++)
Note: See TracChangeset
for help on using the changeset viewer.