Changeset 17980 for branches/2719_HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionModel.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/Regression/RegressionModel.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. … … 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis { 29 [Storable Class]29 [StorableType("2998B895-4724-489C-A4CA-9ADD10C7CA49")] 30 30 [Item("Regression Model", "Base class for all regression models.")] 31 31 public abstract class RegressionModel : DataAnalysisModel, IRegressionModel { … … 41 41 } 42 42 43 protected RegressionModel(bool deserializing) 44 : base(deserializing) { 43 [StorableConstructor] 44 protected RegressionModel(StorableConstructorFlag _) 45 : base(_) { 45 46 targetVariable = string.Empty; 46 47 } … … 67 68 public abstract IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData); 68 69 70 public virtual bool IsProblemDataCompatible(IRegressionProblemData problemData, out string errorMessage) { 71 return IsProblemDataCompatible(this, problemData, out errorMessage); 72 } 73 74 public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) { 75 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 76 var regressionProblemData = problemData as IRegressionProblemData; 77 if (regressionProblemData == null) 78 throw new ArgumentException("The problem data is not compatible with this regression model. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 79 return IsProblemDataCompatible(regressionProblemData, out errorMessage); 80 } 81 82 public static bool IsProblemDataCompatible(IRegressionModel model, IRegressionProblemData problemData, out string errorMessage) { 83 if (model == null) throw new ArgumentNullException("model", "The provided model is null."); 84 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 85 errorMessage = string.Empty; 86 87 if (model.TargetVariable != problemData.TargetVariable) 88 errorMessage = string.Format("The target variable of the model {0} does not match the target variable of the problemData {1}.", model.TargetVariable, problemData.TargetVariable); 89 90 var evaluationErrorMessage = string.Empty; 91 var datasetCompatible = model.IsDatasetCompatible(problemData.Dataset, out evaluationErrorMessage); 92 if (!datasetCompatible) 93 errorMessage += evaluationErrorMessage; 94 95 return string.IsNullOrEmpty(errorMessage); 96 } 97 69 98 #region events 70 99 public event EventHandler TargetVariableChanged;
Note: See TracChangeset
for help on using the changeset viewer.