Changeset 11202 for branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
- Timestamp:
- 07/18/14 12:01:13 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r8528 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 100 100 public string TargetVariable { 101 101 get { return TargetVariableParameter.Value.Value; } 102 set { 103 if (value == null) throw new ArgumentNullException("targetVariable", "The provided value for the targetVariable is null."); 104 if (value == TargetVariable) return; 105 106 var matchingParameterValue = TargetVariableParameter.ValidValues.FirstOrDefault(v => v.Value == value); 107 if (matchingParameterValue == null) throw new ArgumentException("The provided value is not valid as the targetVariable.", "targetVariable"); 108 TargetVariableParameter.Value = matchingParameterValue; 109 } 102 110 } 103 111 … … 129 137 } 130 138 131 public RegressionProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable )132 : base(dataset, allowedInputVariables ) {139 public RegressionProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable, IEnumerable<ITransformation> transformations = null) 140 : base(dataset, allowedInputVariables, transformations ?? Enumerable.Empty<ITransformation>()) { 133 141 var variables = InputVariables.Select(x => x.AsReadOnly()).ToList(); 134 142 Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First())); … … 142 150 OnChanged(); 143 151 } 152 153 protected override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) { 154 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 155 IRegressionProblemData regressionProblemData = problemData as IRegressionProblemData; 156 if (regressionProblemData == null) 157 throw new ArgumentException("The problem data is not a regression problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 158 159 var returnValue = base.IsProblemDataCompatible(problemData, out errorMessage); 160 //check targetVariable 161 if (problemData.InputVariables.All(var => var.Value != TargetVariable)) { 162 errorMessage = string.Format("The target variable {0} is not present in the new problem data.", TargetVariable) 163 + Environment.NewLine + errorMessage; 164 return false; 165 } 166 return returnValue; 167 } 168 169 public override void AdjustProblemDataProperties(IDataAnalysisProblemData problemData) { 170 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 171 RegressionProblemData regressionProblemData = problemData as RegressionProblemData; 172 if (regressionProblemData == null) 173 throw new ArgumentException("The problem data is not a regression problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 174 175 base.AdjustProblemDataProperties(problemData); 176 TargetVariable = regressionProblemData.TargetVariable; 177 } 144 178 } 145 179 }
Note: See TracChangeset
for help on using the changeset viewer.