Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/19/18 13:27:06 (6 years ago)
Author:
mkommend
Message:

#2955: Added IsProblemDataCompatible and IsDatasetCompatible to all DataAnalysisModels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs

    r16086 r16243  
    262262
    263263
     264    public bool IsProblemDataCompatible(IRegressionProblemData problemData, out string errorMessage) {
     265      return RegressionModel.IsProblemDataCompatible(this, problemData, out errorMessage);
     266    }
     267
     268    public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) {
     269      if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");
     270
     271      var regressionProblemData = problemData as IRegressionProblemData;
     272      if (regressionProblemData != null)
     273        return IsProblemDataCompatible(regressionProblemData, out errorMessage);
     274
     275      var classificationProblemData = problemData as IClassificationProblemData;
     276      if (classificationProblemData != null)
     277        return IsProblemDataCompatible(classificationProblemData, out errorMessage);
     278
     279      throw new ArgumentException("The problem data is not a regression nor a classification problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");
     280    }
     281
    264282    IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) {
    265283      return new NearestNeighbourRegressionSolution(this, new RegressionProblemData(problemData));
Note: See TracChangeset for help on using the changeset viewer.