- Timestamp:
- 06/12/14 13:26:18 (10 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing
- 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/DataPreprocessing/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 10540
- Property svn:mergeinfo changed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs
r10922 r11009 222 222 public string TargetVariable { 223 223 get { return TargetVariableParameter.Value.Value; } 224 set { 225 if (value == null) throw new ArgumentNullException("targetVariable", "The provided value for the targetVariable is null."); 226 if (value == TargetVariable) return; 227 228 229 var matchingParameterValue = TargetVariableParameter.ValidValues.FirstOrDefault(v => v.Value == value); 230 if (matchingParameterValue == null) throw new ArgumentException("The provided value is not valid as the targetVariable.", "targetVariable"); 231 TargetVariableParameter.Value = matchingParameterValue; 232 } 224 233 } 225 234 … … 409 418 } 410 419 #endregion 420 421 protected override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) { 422 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 423 IClassificationProblemData classificationProblemData = problemData as IClassificationProblemData; 424 if (classificationProblemData == null) 425 throw new ArgumentException("The problem data is no classification problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 426 427 var returnValue = base.IsProblemDataCompatible(classificationProblemData, out errorMessage); 428 //check targetVariable 429 if (classificationProblemData.InputVariables.All(var => var.Value != TargetVariable)) { 430 errorMessage = string.Format("The target variable {0} is not present in the new problem data.", TargetVariable) 431 + Environment.NewLine + errorMessage; 432 return false; 433 } 434 435 var newClassValues = classificationProblemData.Dataset.GetDoubleValues(TargetVariable).Distinct().OrderBy(x => x); 436 if (!newClassValues.SequenceEqual(ClassValues)) { 437 errorMessage = errorMessage + string.Format("The class values differ in the provided classification problem data."); 438 return false; 439 } 440 441 return returnValue; 442 } 443 444 public override void AdjustProblemDataProperties(IDataAnalysisProblemData problemData) { 445 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 446 ClassificationProblemData classificationProblemData = problemData as ClassificationProblemData; 447 if (classificationProblemData == null) 448 throw new ArgumentException("The problem data is not a classification problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 449 450 base.AdjustProblemDataProperties(problemData); 451 TargetVariable = classificationProblemData.TargetVariable; 452 for (int i = 0; i < classificationProblemData.ClassNames.Count(); i++) 453 ClassNamesParameter.Value[i, 0] = classificationProblemData.ClassNames.ElementAt(i); 454 455 for (int i = 0; i < Classes; i++) { 456 for (int j = 0; j < Classes; j++) { 457 ClassificationPenaltiesParameter.Value[i, j] = classificationProblemData.GetClassificationPenalty(ClassValuesCache[i], ClassValuesCache[j]); 458 } 459 } 460 } 411 461 } 412 462 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r10922 r11009 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Text; 25 26 using HeuristicLab.Collections; 26 27 using HeuristicLab.Common; … … 179 180 if (listeners != null) listeners(this, EventArgs.Empty); 180 181 } 182 183 protected virtual bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) { 184 errorMessage = string.Empty; 185 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 186 187 //check allowed input variables 188 StringBuilder message = new StringBuilder(); 189 var variables = new HashSet<string>(problemData.InputVariables.Select(x => x.Value)); 190 foreach (var item in AllowedInputVariables) { 191 if (!variables.Contains(item)) 192 message.AppendLine("Input variable '" + item + "' is not present in the new problem data."); 193 } 194 195 if (message.Length != 0) { 196 errorMessage = message.ToString(); 197 return false; 198 } 199 return true; 200 201 } 202 203 public virtual void AdjustProblemDataProperties(IDataAnalysisProblemData problemData) { 204 DataAnalysisProblemData data = problemData as DataAnalysisProblemData; 205 if (data == null) throw new ArgumentException("The problem data is not a data analysis problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 206 207 string errorMessage; 208 if (!data.IsProblemDataCompatible(this, out errorMessage)) { 209 throw new InvalidOperationException(errorMessage); 210 } 211 212 foreach (var inputVariable in InputVariables) { 213 var variable = data.InputVariables.FirstOrDefault(i => i.Value == inputVariable.Value); 214 InputVariables.SetItemCheckedState(inputVariable, variable != null && data.InputVariables.ItemChecked(variable)); 215 } 216 217 TrainingPartition.Start = TrainingPartition.End = 0; 218 TestPartition.Start = 0; 219 TestPartition.End = Dataset.Rows; 220 } 181 221 } 182 222 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r10922 r11009 101 101 public string TargetVariable { 102 102 get { return TargetVariableParameter.Value.Value; } 103 set { 104 if (value == null) throw new ArgumentNullException("targetVariable", "The provided value for the targetVariable is null."); 105 if (value == TargetVariable) return; 106 107 var matchingParameterValue = TargetVariableParameter.ValidValues.FirstOrDefault(v => v.Value == value); 108 if (matchingParameterValue == null) throw new ArgumentException("The provided value is not valid as the targetVariable.", "targetVariable"); 109 TargetVariableParameter.Value = matchingParameterValue; 110 } 103 111 } 104 112 … … 143 151 OnChanged(); 144 152 } 153 154 protected override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) { 155 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 156 IRegressionProblemData regressionProblemData = problemData as IRegressionProblemData; 157 if (regressionProblemData == null) 158 throw new ArgumentException("The problem data is not a regression problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 159 160 var returnValue = base.IsProblemDataCompatible(problemData, out errorMessage); 161 //check targetVariable 162 if (problemData.InputVariables.All(var => var.Value != TargetVariable)) { 163 errorMessage = string.Format("The target variable {0} is not present in the new problem data.", TargetVariable) 164 + Environment.NewLine + errorMessage; 165 return false; 166 } 167 return returnValue; 168 } 169 170 public override void AdjustProblemDataProperties(IDataAnalysisProblemData problemData) { 171 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 172 RegressionProblemData regressionProblemData = problemData as RegressionProblemData; 173 if (regressionProblemData == null) 174 throw new ArgumentException("The problem data is not a regression problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 175 176 base.AdjustProblemDataProperties(problemData); 177 TargetVariable = regressionProblemData.TargetVariable; 178 } 145 179 } 146 180 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisProblemData.cs
r9552 r11009 1621 1621 } 1622 1622 1623 public override void AdjustProblemDataProperties(IDataAnalysisProblemData problemData) { 1624 TimeSeriesPrognosisProblemData timeSeriesProblemData = problemData as TimeSeriesPrognosisProblemData; 1625 if (timeSeriesProblemData == null) 1626 throw new ArgumentException("The problem data is not a timeseries problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 1627 1628 base.AdjustProblemDataProperties(problemData); 1629 1630 TrainingHorizon = timeSeriesProblemData.TrainingHorizon; 1631 TestHorizon = timeSeriesProblemData.TestHorizon; 1632 } 1633 1623 1634 } 1624 1635 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationProblemData.cs
r9456 r11009 23 23 namespace HeuristicLab.Problems.DataAnalysis { 24 24 public interface IClassificationProblemData : IDataAnalysisProblemData { 25 string TargetVariable { get; }25 string TargetVariable { get; set; } 26 26 27 27 IEnumerable<string> ClassNames { get; } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs
r10772 r11009 46 46 47 47 event EventHandler Changed; 48 49 void AdjustProblemDataProperties(IDataAnalysisProblemData problemData); 48 50 } 49 51 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs
r9456 r11009 22 22 namespace HeuristicLab.Problems.DataAnalysis { 23 23 public interface IRegressionProblemData : IDataAnalysisProblemData { 24 string TargetVariable { get; }24 string TargetVariable { get; set; } 25 25 } 26 26 }
Note: See TracChangeset
for help on using the changeset viewer.