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/SupportVectorMachine/SupportVectorMachineModel.cs

    r15854 r16243  
    126126      return new SupportVectorRegressionSolution(this, new RegressionProblemData(problemData));
    127127    }
    128     #endregion
     128
     129    public bool IsProblemDataCompatible(IRegressionProblemData problemData, out string errorMessage) {
     130      return RegressionModel.IsProblemDataCompatible(this, problemData, out errorMessage);
     131    }
     132    #endregion
     133
     134    public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) {
     135      if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");
     136
     137      var regressionProblemData = problemData as IRegressionProblemData;
     138      if (regressionProblemData != null)
     139        return IsProblemDataCompatible(regressionProblemData, out errorMessage);
     140
     141      var classificationProblemData = problemData as IClassificationProblemData;
     142      if (classificationProblemData != null)
     143        return IsProblemDataCompatible(classificationProblemData, out errorMessage);
     144
     145      throw new ArgumentException("The problem data is not a regression nor a classification problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");
     146    }
    129147
    130148    #region IClassificationModel Members
     
    153171    }
    154172    #endregion
     173
    155174    private IEnumerable<double> GetEstimatedValuesHelper(IDataset dataset, IEnumerable<int> rows) {
    156175      // calculate predictions for the currently requested rows
Note: See TracChangeset for help on using the changeset viewer.