- Timestamp:
- 02/24/11 16:44:24 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblemData.cs
r5554 r5559 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Collections;26 25 using HeuristicLab.Common; 27 26 using HeuristicLab.Core; 28 using HeuristicLab.Data;29 using HeuristicLab.Parameters;30 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 28 32 29 namespace HeuristicLab.Problems.DataAnalysis { 33 30 [StorableClass] 34 public abstract class DataAnalysisProblemData : ParameterizedNamedItem, 35 IDataAnalysisProblemData { 36 private const string DatasetParameterName = "Dataset"; 37 private const string InputVariablesParameterName = "Input variables"; 38 private const string TrainingSamplesStartParameterName = "Training partition start"; 39 private const string TrainingSamplesEndParameterName = "Training partition end"; 40 private const string TestSamplesStartParameterName = "Test partition start"; 41 private const string TestSamplesEndParameterName = "Test partition end"; 42 43 #region parameter properties 44 public IValueParameter<Dataset> DatasetParameter { 45 get { return (IValueParameter<Dataset>)Parameters[DatasetParameterName]; } 46 } 47 public IValueParameter<ICheckedItemList<StringValue>> InputVariablesParameter { 48 get { return (IValueParameter<ICheckedItemList<StringValue>>)Parameters[InputVariablesParameterName]; } 49 } 50 public IValueParameter<IntValue> TrainingSamplesStartParameter { 51 get { return (IValueParameter<IntValue>)Parameters[TrainingSamplesStartParameterName]; } 52 } 53 public IValueParameter<IntValue> TrainingSamplesEndParameter { 54 get { return (IValueParameter<IntValue>)Parameters[TrainingSamplesEndParameterName]; } 55 } 56 public IValueParameter<IntValue> TestSamplesStartParameter { 57 get { return (IValueParameter<IntValue>)Parameters[TestSamplesStartParameterName]; } 58 } 59 public IValueParameter<IntValue> TestSamplesEndParameter { 60 get { return (IValueParameter<IntValue>)Parameters[TestSamplesEndParameterName]; } 61 } 62 #endregion 63 31 public abstract class DataAnalysisProblemData : NamedItem, IDataAnalysisProblemData { 64 32 #region propeties 33 [Storable] 34 private Dataset dataset; 65 35 public Dataset Dataset { 66 get { return DatasetParameter.Value; } 67 } 68 public IEnumerable<string> AllowedInputVariables { 69 get { return InputVariablesParameter.Value.CheckedItems.Select(i => i.Value.Value); } 36 get { return dataset; } 70 37 } 71 38 72 public int TrainingSamplesStart { 73 get { return TrainingSamplesStartParameter.Value.Value; } 74 set { TrainingSamplesStartParameter.Value.Value = value; } 75 } 76 public int TrainingSamplesEnd { 77 get { return TrainingSamplesEndParameter.Value.Value; } 78 set { TrainingSamplesEndParameter.Value.Value = value; } 39 [Storable] 40 private HashSet<string> allowedInputVariables; 41 public IEnumerable<string> AllowedInputVariables { 42 get { return allowedInputVariables; } 79 43 } 80 44 81 public int TestSamplesStart { 82 get { return TestSamplesStartParameter.Value.Value; } 83 set { TestSamplesStartParameter.Value.Value = value; } 45 [Storable] 46 private int trainingPartitionStart; 47 public int TrainingPartitionStart { 48 get { return trainingPartitionStart; } 49 set { 50 if (0 < value || value > dataset.Rows) 51 throw new ArgumentException(string.Format("The training partition start must be between 0 and the number of rows of the dataset ({0})", dataset.Rows)); 52 if (trainingPartitionStart != value) { 53 trainingPartitionStart = value; 54 OnChanged(); 55 } 56 } 84 57 } 85 public int TestSamplesEnd { 86 get { return TestSamplesEndParameter.Value.Value; } 87 set { TestSamplesEndParameter.Value.Value = value; } 58 [Storable] 59 private int trainingPartitionEnd; 60 public int TrainingPartitionEnd { 61 get { return trainingPartitionEnd; } 62 set { 63 if (0 < value || value > dataset.Rows) 64 throw new ArgumentException(string.Format("The training partition end must be between 0 and the number of rows of the dataset ({0})", dataset.Rows)); 65 if (trainingPartitionEnd != value) { 66 trainingPartitionEnd = value; 67 OnChanged(); 68 } 69 } 70 } 71 72 [Storable] 73 private int testPartitionStart; 74 public int TestPartitionStart { 75 get { return testPartitionStart; } 76 set { 77 if (0 < value || value > dataset.Rows) 78 throw new ArgumentException(string.Format("The test partition start must be between 0 and the number of rows of the dataset ({0})", dataset.Rows)); 79 if (testPartitionStart != value) { 80 testPartitionStart = value; 81 OnChanged(); 82 } 83 } 84 } 85 [Storable] 86 private int testPartitionEnd; 87 public int TestPartitionEnd { 88 get { return testPartitionEnd; } 89 set { 90 if (0 < value || value > dataset.Rows) 91 throw new ArgumentException(string.Format("The test partition end must be between 0 and the number of rows of the dataset ({0})", dataset.Rows)); 92 if (testPartitionEnd != value) { 93 testPartitionEnd = value; 94 OnChanged(); 95 } 96 } 88 97 } 89 98 90 99 public IEnumerable<int> TrainingIndizes { 91 100 get { 92 return Enumerable.Range(Training SamplesStart, TrainingSamplesEnd - TrainingSamplesStart)93 .Where(i => i >= 0 && i < Dataset.Rows && (i < Test SamplesStart || TestSamplesEnd <= i));101 return Enumerable.Range(TrainingPartitionStart, TrainingPartitionEnd - TrainingPartitionStart) 102 .Where(i => i >= 0 && i < Dataset.Rows && (i < TestPartitionStart || TestPartitionEnd <= i)); 94 103 } 95 104 } 96 105 public IEnumerable<int> TestIndizes { 97 106 get { 98 return Enumerable.Range(Test SamplesStart, TestSamplesEnd - TestSamplesStart)107 return Enumerable.Range(TestPartitionStart, TestPartitionEnd - TestPartitionStart) 99 108 .Where(i => i >= 0 && i < Dataset.Rows); 100 109 } … … 102 111 #endregion 103 112 104 protected DataAnalysisProblemData(DataAnalysisProblemData original, Cloner cloner) 105 : base(original, cloner) { 106 RegisterEventHandlers(); 107 } 113 protected DataAnalysisProblemData(DataAnalysisProblemData original, Cloner cloner) : base(original, cloner) { } 108 114 [StorableConstructor] 109 115 protected DataAnalysisProblemData(bool deserializing) : base(deserializing) { } 116 110 117 protected DataAnalysisProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables) { 118 if (dataset == null) throw new ArgumentNullException("The dataset must not be null."); 119 if (allowedInputVariables == null) throw new ArgumentNullException("The allowedInputVariables must not be null."); 120 111 121 if (allowedInputVariables.Except(dataset.VariableNames).Any()) 112 122 throw new ArgumentException("All allowed input variables must be present in the dataset."); 113 123 114 ICheckedItemList<StringValue> inputVariableList = new CheckedItemList<StringValue>(dataset.VariableNames.Select(x => new StringValue(x))).AsReadOnly(); 115 foreach (StringValue inputVariable in inputVariableList) { 116 inputVariableList.SetItemCheckedState(inputVariable, allowedInputVariables.Contains(inputVariable.Value)); 117 } 118 119 Parameters.Add(new ValueParameter<Dataset>(DatasetParameterName, dataset)); 120 Parameters.Add(new ValueParameter<ICheckedItemList<StringValue>>(InputVariablesParameterName, inputVariableList)); 121 Parameters.Add(new ValueParameter<IntValue>(TrainingSamplesStartParameterName, new IntValue(0))); 122 Parameters.Add(new ValueParameter<IntValue>(TrainingSamplesEndParameterName, new IntValue(dataset.Rows))); 123 Parameters.Add(new ValueParameter<IntValue>(TestSamplesStartParameterName, new IntValue(dataset.Rows))); 124 Parameters.Add(new ValueParameter<IntValue>(TestSamplesEndParameterName, new IntValue(dataset.Rows))); 125 126 RegisterEventHandlers(); 124 this.dataset = dataset; 125 allowedInputVariables = new HashSet<string>(allowedInputVariables); 126 trainingPartitionStart = 0; 127 trainingPartitionEnd = dataset.Rows / 2; 128 testPartitionStart = dataset.Rows / 2; 129 testPartitionEnd = dataset.Rows; 127 130 } 128 131 129 [StorableHook(HookType.AfterDeserialization)] 130 private void AfterDeserialization() { 131 RegisterEventHandlers(); 132 public bool AddAllowedInputVariable(string inputVariable) { 133 if (!Dataset.VariableNames.Contains(inputVariable)) 134 throw new ArgumentException("The allowed input variable must be present in the dataset."); 135 if (allowedInputVariables.Contains(inputVariable)) return false; 136 137 allowedInputVariables.Add(inputVariable); 138 return true; 132 139 } 140 public bool RemoveAllowedInputVariable(string inputVariable) { 141 if (!Dataset.VariableNames.Contains(inputVariable)) 142 throw new ArgumentException("The allowed input variable must be present in the dataset."); 143 if (!allowedInputVariables.Contains(inputVariable)) return false; 133 144 134 #region changed event propagation 135 private void RegisterEventHandlers() { 136 DatasetParameter.ValueChanged += new EventHandler(Dataset_Changed); 137 TrainingSamplesStartParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged); 138 TrainingSamplesEndParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged); 139 TestSamplesStartParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged); 140 TestSamplesEndParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged); 141 142 InputVariablesParameter.ValueChanged += new EventHandler(InputVariablesParameter_ValueChanged); 143 RegisterInputVariablesParameterValueEventHandlers(); 144 145 TrainingSamplesStartParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged); 146 TrainingSamplesEndParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged); 147 TestSamplesStartParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged); 148 TestSamplesEndParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged); 149 } 150 private void RegisterInputVariablesParameterValueEventHandlers() { 151 InputVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed); 152 InputVariablesParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed); 153 InputVariablesParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed); 154 InputVariablesParameter.Value.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed); 155 InputVariablesParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed); 156 InputVariablesParameter.Value.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed); 157 } 158 159 private void PartitionParameter_ValueChanged(object sender, EventArgs e) { 160 IntValue value = (IntValue)sender; 161 value.ValueChanged += new EventHandler(Partitions_ValueChanged); 162 OnChanged(); 163 } 164 private void InputVariablesParameter_ValueChanged(object sender, EventArgs e) { 165 RegisterInputVariablesParameterValueEventHandlers(); 166 } 167 168 private void Partitions_ValueChanged(object sender, EventArgs e) { 169 OnChanged(); 170 } 171 private void InputVariables_Changed(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> e) { 172 OnChanged(); 173 } 174 private void Dataset_Changed(object sender, EventArgs e) { 175 OnChanged(); 145 allowedInputVariables.Remove(inputVariable); 146 return true; 176 147 } 177 148 … … 181 152 if (listeners != null) listeners(this, EventArgs.Empty); 182 153 } 183 #endregion184 154 } 185 155 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r5554 r5559 36 36 private Dataset(Dataset original, Cloner cloner) 37 37 : base(original, cloner) { 38 variableName s = original.variableNames;38 variableNameToVariableIndexMapping = original.variableNameToVariableIndexMapping; 39 39 data = original.data; 40 40 } … … 54 54 55 55 56 private Dictionary<string, int> variableNames; 56 private Dictionary<string, int> variableNameToVariableIndexMapping; 57 private Dictionary<int, string> variableIndexToVariableNameMapping; 57 58 [Storable] 58 59 public IEnumerable<string> VariableNames { 59 get { return variableName s.Keys; }60 get { return variableNameToVariableIndexMapping.Keys; } 60 61 private set { 61 if (variableName s!= null) throw new InvalidOperationException("VariableNames can only be set once.");62 this.variableName s= new Dictionary<string, int>();62 if (variableNameToVariableIndexMapping != null) throw new InvalidOperationException("VariableNames can only be set once."); 63 this.variableNameToVariableIndexMapping = new Dictionary<string, int>(); 63 64 int i = 0; 64 65 foreach (string variableName in value) { 65 this.variableName s.Add(variableName, i);66 this.variableNameToVariableIndexMapping.Add(variableName, i); 66 67 i++; 67 68 } 69 variableNameToVariableIndexMapping = variableIndexToVariableNameMapping.ToDictionary(x => x.Value, x => x.Key); 68 70 } 69 71 } … … 127 129 128 130 public string GetVariableName(int variableIndex) { 129 return VariableNames.ElementAt(variableIndex); 131 try { 132 return variableIndexToVariableNameMapping[variableIndex]; 133 } 134 catch (KeyNotFoundException ex) { 135 throw new ArgumentException("The variable index " + variableIndex + " was not found.", ex); 136 } 130 137 } 131 138 public int GetVariableIndex(string variableName) { 132 139 try { 133 return variableName s[variableName];140 return variableNameToVariableIndexMapping[variableName]; 134 141 } 135 142 catch (KeyNotFoundException ex) { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r5540 r5559 108 108 </ItemGroup> 109 109 <ItemGroup> 110 <Compile Include="ClassificationProblemData.cs" /> 110 111 <Compile Include="RegressionProblemData.cs" /> 111 112 <Compile Include="DataAnalysisProblemData.cs" /> -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationProblemData.cs
r5501 r5559 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 namespace HeuristicLab.Problems.DataAnalysis { 24 25 public interface IClassificationProblemData : IDataAnalysisProblemData { 25 string TargetVariable { get; } 26 int NumberOfClasses { get; } 27 26 string TargetVariable { get; set; } 28 27 IEnumerable<string> ClassNames { get; } 29 28 IEnumerable<double> ClassValues { get; } 29 int Classes { get; } 30 30 31 31 string GetClassName(double classValue); 32 32 double GetClassValue(string className); 33 void SetClassName(double classValue, string className); 33 34 34 35 double GetClassificationPenalty(string correctClass, string estimatedClass); 35 36 double GetClassificationPenalty(double correctClassValue, double estimatedClassValue); 37 void SetClassificationPenalty(string correctClassName, string estimatedClassName, double penalty); 38 void SetClassificationPenalty(double correctClassValue, double estimatedClassValue, double penalty); 39 40 event EventHandler ClassNamesChanged; 41 event EventHandler ClassificationPenaltyChanged; 36 42 } 37 43 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs
r5554 r5559 29 29 IEnumerable<string> AllowedInputVariables { get; } 30 30 31 int TrainingSamplesStart { get; set; } 32 int TrainingSamplesEnd { get; set; } 33 int TestSamplesStart { get; set; } 34 int TestSamplesEnd { get; set; } 31 bool AddAllowedInputVariable(string inputVariable); 32 bool RemoveAllowedInputVariable(string inputVariable); 33 34 int TrainingPartitionStart { get; set; } 35 int TrainingPartitionEnd { get; set; } 36 int TestPartitionStart { get; set; } 37 int TestPartitionEnd { get; set; } 35 38 36 39 IEnumerable<int> TrainingIndizes { get; } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs
r5496 r5559 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 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineCovarianceEvaluator.cs
r5507 r5559 74 74 OnlineCovarianceEvaluator covarianceEvaluator = new OnlineCovarianceEvaluator(); 75 75 76 while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {76 while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) { 77 77 double estimated = secondEnumerator.Current; 78 78 double original = firstEnumerator.Current; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs
r5507 r5559 76 76 } 77 77 78 if (secondEnumerator.MoveNext() ||firstEnumerator.MoveNext()) {78 if (secondEnumerator.MoveNext() && firstEnumerator.MoveNext()) { 79 79 throw new ArgumentException("Number of elements in first and second enumeration doesn't match."); 80 80 } else { -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanSquaredErrorEvaluator.cs
r5500 r5559 67 67 OnlineMeanSquaredErrorEvaluator mseEvaluator = new OnlineMeanSquaredErrorEvaluator(); 68 68 69 while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {69 while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) { 70 70 double estimated = secondEnumerator.Current; 71 71 double original = firstEnumerator.Current; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs
r5507 r5559 67 67 OnlineNormalizedMeanSquaredErrorEvaluator normalizedMSEEvaluator = new OnlineNormalizedMeanSquaredErrorEvaluator(); 68 68 69 while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {69 while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) { 70 70 double estimated = secondEnumerator.Current; 71 71 double original = firstEnumerator.Current; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs
r5500 r5559 75 75 OnlinePearsonsRSquaredEvaluator rSquaredEvaluator = new OnlinePearsonsRSquaredEvaluator(); 76 76 77 while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {77 while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) { 78 78 double estimated = secondEnumerator.Current; 79 79 double original = firstEnumerator.Current; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblemData.cs
r5554 r5559 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.IO; 24 25 using System.Linq; 25 26 using HeuristicLab.Common; 26 using HeuristicLab.Core;27 using HeuristicLab.Data;28 using HeuristicLab.Parameters;29 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 28 31 29 namespace HeuristicLab.Problems.DataAnalysis { 32 30 [StorableClass] 33 public sealed class RegressionProblemData : DataAnalysisProblemData, 34 IRegressionProblemData { 35 private const string TargetVariableParameterName = "Target variable"; 31 public sealed class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData { 36 32 37 33 #region default data … … 69 65 static RegressionProblemData() { 70 66 defaultDataset = new Dataset(new string[] { "y", "x" }, kozaF1); 67 defaultDataset.Name = "Fourth-order Polynomial Function Benchmark Dataset"; 68 defaultDataset.Description = "f(x) = x^4 + x^3 + x^2 + x^1"; 71 69 defaultAllowedInputVariables = new List<string>() { "x" }; 72 70 defaultTargetVariable = "y"; … … 74 72 #endregion 75 73 76 #region parameter properties77 public IValueParameter<StringValue> TargetVariableParameter {78 get { return (IValueParameter<StringValue>)Parameters[TargetVariableParameterName]; }79 }80 #endregion81 74 #region propeties 75 [Storable] 76 private string targetVariable; 82 77 public string TargetVariable { 83 get { return TargetVariableParameter.Value.Value; } 78 get { return targetVariable; } 79 set { 80 if (!Dataset.VariableNames.Contains(value)) 81 throw new ArgumentException(string.Format("The target variable {0} is not present in the dataset", value)); 82 if (targetVariable != value) { 83 targetVariable = value; 84 OnChanged(); 85 } 86 } 84 87 } 85 88 #endregion … … 87 90 [StorableConstructor] 88 91 private RegressionProblemData(bool deserializing) : base(deserializing) { } 89 private RegressionProblemData(RegressionProblemData original, Cloner cloner) 90 : base(original, cloner) { 91 RegisterEventHandlers(); 92 } 92 private RegressionProblemData(RegressionProblemData original, Cloner cloner) : base(original, cloner) { } 93 93 public override IDeepCloneable Clone(Cloner cloner) { return new RegressionProblemData(this, cloner); } 94 94 … … 99 99 public RegressionProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable) 100 100 : base(dataset, allowedInputVariables) { 101 if (!dataset.VariableNames.Contains(targetVariable)) 102 throw new ArgumentException("The target variable must be present in the dataset"); 103 104 ConstrainedValueParameter<StringValue> targetVariableParameter = new ConstrainedValueParameter<StringValue>(TargetVariableParameterName); 105 foreach (var variableName in dataset.VariableNames) { 106 StringValue targetVariableValue = new StringValue(variableName); 107 targetVariableParameter.ValidValues.Add(targetVariableValue); 108 if (variableName == targetVariable) 109 targetVariableParameter.Value = targetVariableValue; 110 } 111 112 Parameters.Add(targetVariableParameter); 113 RegisterEventHandlers(); 101 TargetVariable = targetVariable; 114 102 } 115 103 104 public static RegressionProblemData ImportFromFile(string fileName) { 105 TableFileParser csvFileParser = new TableFileParser(); 106 csvFileParser.Parse(fileName); 116 107 108 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 109 dataset.Name = Path.GetFileName(fileName); 117 110 118 [StorableHook(HookType.AfterDeserialization)]119 private void AfterDeserialization() {120 RegisterEventHandlers();111 RegressionProblemData problemData = new RegressionProblemData(dataset, dataset.VariableNames.Skip(1), dataset.VariableNames.First()); 112 problemData.Name = "Data imported from " + Path.GetFileName(fileName); 113 return problemData; 121 114 } 122 123 #region event propagation124 private void RegisterEventHandlers() {125 TargetVariableParameter.Value.ValueChanged += new EventHandler(TargetVariable_ValueChanged);126 TargetVariableParameter.ValueChanged += new EventHandler(TargetVariableParameter_ValueChanged);127 }128 129 private void TargetVariableParameter_ValueChanged(object sender, EventArgs e) {130 TargetVariableParameter.Value.ValueChanged += new EventHandler(TargetVariable_ValueChanged);131 OnChanged();132 }133 134 private void TargetVariable_ValueChanged(object sender, EventArgs e) {135 OnChanged();136 }137 #endregion138 115 } 139 116 }
Note: See TracChangeset
for help on using the changeset viewer.