Changeset 17980 for branches/2719_HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs
- Timestamp:
- 05/10/21 09:48:16 (3 years ago)
- Location:
- branches/2719_HeuristicLab.DatastreamAnalysis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2719_HeuristicLab.DatastreamAnalysis
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis merged eligible /branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis merged eligible /trunk/HeuristicLab.Problems.DataAnalysis merged eligible /branches/3073_IA_constraint_splitting_reintegration/HeuristicLab.Problems.DataAnalysis 17885-17900 /branches/3105_PythonFormatter/HeuristicLab.Problems.DataAnalysis 17842-17921
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/2719_HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
branches/2719_HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs
r15866 r17980 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2018Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Parameters; 29 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;29 using HEAL.Attic; 30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis { 32 [Storable Class]32 [StorableType("1C8DCCCF-4E2A-421D-9C61-7C017D584054")] 33 33 [Item("ClassificationProblemData", "Represents an item containing all data defining a classification problem.")] 34 34 public class ClassificationProblemData : DataAnalysisProblemData, IClassificationProblemData, IStorableContent { … … 279 279 280 280 [StorableConstructor] 281 protected ClassificationProblemData( bool deserializing) : base(deserializing) { }281 protected ClassificationProblemData(StorableConstructorFlag _) : base(_) { } 282 282 [StorableHook(HookType.AfterDeserialization)] 283 283 private void AfterDeserialization() { … … 467 467 } 468 468 #endregion 469 470 protected override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) {471 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");472 IClassificationProblemData classificationProblemData = problemData as IClassificationProblemData;473 if (classificationProblemData == null)474 throw new ArgumentException("The problem data is no classification problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");475 476 var returnValue = base.IsProblemDataCompatible(classificationProblemData, out errorMessage);477 //check targetVariable478 if (classificationProblemData.InputVariables.All(var => var.Value != TargetVariable)) {479 errorMessage = string.Format("The target variable {0} is not present in the new problem data.", TargetVariable)480 + Environment.NewLine + errorMessage;481 return false;482 }483 484 var newClassValues = classificationProblemData.Dataset.GetDoubleValues(TargetVariable).Distinct().OrderBy(x => x);485 if (!newClassValues.SequenceEqual(ClassValues)) {486 errorMessage = errorMessage + string.Format("The class values differ in the provided classification problem data.");487 returnValue = false;488 }489 490 var newPositivieClassName = classificationProblemData.PositiveClass;491 if (newPositivieClassName != PositiveClass) {492 errorMessage = errorMessage + string.Format("The positive class differs in the provided classification problem data.");493 returnValue = false;494 }495 496 return returnValue;497 }498 499 public override void AdjustProblemDataProperties(IDataAnalysisProblemData problemData) {500 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");501 ClassificationProblemData classificationProblemData = problemData as ClassificationProblemData;502 if (classificationProblemData == null)503 throw new ArgumentException("The problem data is not a classification problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");504 505 base.AdjustProblemDataProperties(problemData);506 TargetVariable = classificationProblemData.TargetVariable;507 for (int i = 0; i < classificationProblemData.ClassNames.Count(); i++)508 ClassNamesParameter.Value[i, 0] = classificationProblemData.ClassNames.ElementAt(i);509 510 PositiveClass = classificationProblemData.PositiveClass;511 512 for (int i = 0; i < Classes; i++) {513 for (int j = 0; j < Classes; j++) {514 ClassificationPenaltiesParameter.Value[i, j] = classificationProblemData.GetClassificationPenalty(ClassValuesCache[i], ClassValuesCache[j]);515 }516 }517 }518 469 } 519 470 }
Note: See TracChangeset
for help on using the changeset viewer.