Changeset 12218 for branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs
- Timestamp:
- 03/17/15 17:22:57 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs
r12216 r12218 88 88 var classValuesArr = classValues.ToArray(); 89 89 var thresholdsArr = thresholds.ToArray(); 90 if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1) 90 if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1) 91 91 throw new ArgumentException(); 92 if (!double.IsNegativeInfinity(thresholds.First())) 92 if (!double.IsNegativeInfinity(thresholds.First())) 93 93 throw new ArgumentException(); 94 94 … … 113 113 public override IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) { 114 114 if (!Thresholds.Any() && !ClassValues.Any()) throw new ArgumentException("No thresholds and class values were set for the current symbolic classification model."); 115 foreach (var x in GetEstimatedValues(dataset, rows)) { 116 int classIndex = 0; 117 // find first threshold value which is larger than x => class index = threshold index + 1 118 for (int i = 0; i < thresholds.Length; i++) { 119 if (x > thresholds[i]) classIndex++; 120 else break; 121 } 122 yield return classValues.ElementAt(classIndex - 1); 123 } 115 var estimatedValues = GetEstimatedValues(dataset, rows); 116 return GetEstimatedClassValues(estimatedValues); 124 117 } 125 118 public IEnumerable<double> GetEstimatedClassValues(IEnumerable<double> estimatedValues) {
Note: See TracChangeset
for help on using the changeset viewer.