- Timestamp:
- 10/19/18 13:27:06 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationModel.cs
r15583 r16243 66 66 public abstract IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData); 67 67 68 public virtual bool IsProblemDataCompatible(IClassificationProblemData problemData, out string errorMessage) { 69 return IsProblemDataCompatible(this, problemData, out errorMessage); 70 } 71 72 public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) { 73 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 74 var classificationProblemData = problemData as IClassificationProblemData; 75 if (classificationProblemData == null) 76 throw new ArgumentException("The problem data is not a regression problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 77 return IsProblemDataCompatible(classificationProblemData, out errorMessage); 78 } 79 80 public static bool IsProblemDataCompatible(IClassificationModel model, IClassificationProblemData problemData, out string errorMessage) { 81 if (model == null) throw new ArgumentNullException("model", "The provided model is null."); 82 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 83 errorMessage = string.Empty; 84 85 if (model.TargetVariable != problemData.TargetVariable) 86 errorMessage = string.Format("The target variable of the model {0} does not match the target variable of the problemData {1}.", model.TargetVariable, problemData.TargetVariable); 87 88 var evaluationErrorMessage = string.Empty; 89 var datasetCompatible = model.IsDatasetCompatible(problemData.Dataset, out evaluationErrorMessage); 90 if (!datasetCompatible) 91 errorMessage += evaluationErrorMessage; 92 93 return string.IsNullOrEmpty(errorMessage); 94 } 95 68 96 #region events 69 97 public event EventHandler TargetVariableChanged;
Note: See TracChangeset
for help on using the changeset viewer.