- Timestamp:
- 01/15/15 13:48:00 (10 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationPerformanceMeasures.cs
r11763 r11766 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Optimization; … … 51 52 protected ClassificationPerformanceMeasuresResultCollection(bool deserializing) 52 53 : base(deserializing) { 54 } 55 56 protected ClassificationPerformanceMeasuresResultCollection(ClassificationPerformanceMeasuresResultCollection original, Cloner cloner) 57 : base(original, cloner) { } 58 public override IDeepCloneable Clone(Cloner cloner) { 59 return new ClassificationPerformanceMeasuresResultCollection(this, cloner); 53 60 } 54 61 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs
r11763 r11766 36 36 protected const string ClassNamesParameterName = "ClassNames"; 37 37 protected const string ClassificationPenaltiesParameterName = "ClassificationPenalties"; 38 protected const string PositiveClass NameParameterName = "PositiveClass";38 protected const string PositiveClassParameterName = "PositiveClass"; 39 39 protected const int MaximumNumberOfClasses = 100; 40 40 protected const int InspectedRowsToDetermineTargets = 2000; … … 214 214 get { return (IFixedValueParameter<StringMatrix>)Parameters[ClassNamesParameterName]; } 215 215 } 216 public IConstrainedValueParameter<StringValue> PositiveClass NameParameter {217 get { return (IConstrainedValueParameter<StringValue>)Parameters[PositiveClass NameParameterName]; }216 public IConstrainedValueParameter<StringValue> PositiveClassParameter { 217 get { return (IConstrainedValueParameter<StringValue>)Parameters[PositiveClassParameterName]; } 218 218 } 219 219 public IFixedValueParameter<DoubleMatrix> ClassificationPenaltiesParameter { … … 267 267 } 268 268 269 public string PositiveClass Name{270 get { return PositiveClass NameParameter.Value.Value; }269 public string PositiveClass { 270 get { return PositiveClassParameter.Value.Value; } 271 271 set { 272 var matchingValue = PositiveClass NameParameter.ValidValues.SingleOrDefault(x => x.Value == value);272 var matchingValue = PositiveClassParameter.ValidValues.SingleOrDefault(x => x.Value == value); 273 273 if (matchingValue == null) throw new ArgumentException(string.Format("{0} cannot be set as positive class.", value)); 274 PositiveClass NameParameter.Value = matchingValue;274 PositiveClassParameter.Value = matchingValue; 275 275 } 276 276 } … … 285 285 // BackwardsCompatibility3.4 286 286 #region Backwards compatible code, remove with 3.5 287 if (!Parameters.ContainsKey(PositiveClass NameParameterName)) {287 if (!Parameters.ContainsKey(PositiveClassParameterName)) { 288 288 var validValues = new ItemSet<StringValue>(ClassNames.Select(s => new StringValue(s).AsReadOnly())); 289 Parameters.Add(new ConstrainedValueParameter<StringValue>(PositiveClass NameParameterName,289 Parameters.Add(new ConstrainedValueParameter<StringValue>(PositiveClassParameterName, 290 290 "The positive class which is used for quality measure calculation (e.g., specifity, sensitivity,...)", validValues, validValues.First())); 291 291 } … … 329 329 Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(validTargetVariableValues), target)); 330 330 Parameters.Add(new FixedValueParameter<StringMatrix>(ClassNamesParameterName, "")); 331 Parameters.Add(new ConstrainedValueParameter<StringValue>(PositiveClass NameParameterName, "The positive class which is used for quality measure calculation (e.g., specifity, sensitivity,...)"));331 Parameters.Add(new ConstrainedValueParameter<StringValue>(PositiveClassParameterName, "The positive class which is used for quality measure calculation (e.g., specifity, sensitivity,...)")); 332 332 Parameters.Add(new FixedValueParameter<DoubleMatrix>(ClassificationPenaltiesParameterName, "")); 333 333 … … 363 363 ClassNamesParameter.Value.RowNames = ClassValues.Select(s => "ClassValue: " + s); 364 364 365 PositiveClass NameParameter.ValidValues.Clear();365 PositiveClassParameter.ValidValues.Clear(); 366 366 foreach (var className in ClassNames) { 367 PositiveClass NameParameter.ValidValues.Add(new StringValue(className).AsReadOnly());367 PositiveClassParameter.ValidValues.Add(new StringValue(className).AsReadOnly()); 368 368 } 369 369 … … 439 439 } 440 440 private void Parameter_ValueChanged(object sender, EventArgs e) { 441 var oldPositiveClass = PositiveClass Name;441 var oldPositiveClass = PositiveClass; 442 442 var oldClassNames = classNamesCache; 443 443 var index = oldClassNames.IndexOf(oldPositiveClass); … … 447 447 ClassificationPenaltiesParameter.Value.ColumnNames = ClassNames.Select(name => "Estimated " + name); 448 448 449 PositiveClass NameParameter.ValidValues.Clear();449 PositiveClassParameter.ValidValues.Clear(); 450 450 foreach (var className in ClassNames) { 451 PositiveClass NameParameter.ValidValues.Add(new StringValue(className).AsReadOnly());452 } 453 PositiveClass NameParameter.Value = PositiveClassNameParameter.ValidValues.ElementAt(index);451 PositiveClassParameter.ValidValues.Add(new StringValue(className).AsReadOnly()); 452 } 453 PositiveClassParameter.Value = PositiveClassParameter.ValidValues.ElementAt(index); 454 454 455 455 OnChanged(); … … 477 477 } 478 478 479 var newPositivieClassName = classificationProblemData.PositiveClass Name;480 if (newPositivieClassName != PositiveClass Name) {479 var newPositivieClassName = classificationProblemData.PositiveClass; 480 if (newPositivieClassName != PositiveClass) { 481 481 errorMessage = errorMessage + string.Format("The positive class differs in the provided classification problem data."); 482 482 returnValue = false; … … 497 497 ClassNamesParameter.Value[i, 0] = classificationProblemData.ClassNames.ElementAt(i); 498 498 499 PositiveClass Name = classificationProblemData.PositiveClassName;499 PositiveClass = classificationProblemData.PositiveClass; 500 500 501 501 for (int i = 0; i < Classes; i++) { -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionBase.cs
r11763 r11766 95 95 In a multiclass classification all misclassifications of the negative class will be treated as true negatives except on positive class estimations.", 96 96 new ClassificationPerformanceMeasuresResultCollection())); 97 RecalculateResults();97 CalculateClassificationResults(); 98 98 } 99 99 } … … 106 106 double[] originalTestClassValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndices).ToArray(); 107 107 108 var positiveClassName = ProblemData.PositiveClass Name;108 var positiveClassName = ProblemData.PositiveClass; 109 109 double positiveClassValue = ProblemData.GetClassValue(positiveClassName); 110 110 ClassificationPerformanceMeasuresCalculator trainingPerformanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassName, positiveClassValue);
Note: See TracChangeset
for help on using the changeset viewer.