Changeset 6720 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 09/08/11 13:40:48 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs
r6649 r6720 113 113 private NeuralNetworkClassification(NeuralNetworkClassification original, Cloner cloner) 114 114 : base(original, cloner) { 115 RegisterEventHandlers(); 115 116 } 116 117 public NeuralNetworkClassification() 117 118 : base() { 118 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { new IntValue(0), new IntValue(1), new IntValue(2) }); 119 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 120 (IntValue)new IntValue(0).AsReadOnly(), 121 (IntValue)new IntValue(1).AsReadOnly(), 122 (IntValue)new IntValue(2).AsReadOnly() }); 119 123 var selectedHiddenLayerValue = (from v in validHiddenLayerValues 120 124 where v.Value == 1 … … 127 131 Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of restarts for learning.", new IntValue(2))); 128 132 133 RestartsParameter.Hidden = true; 134 NodesInSecondHiddenLayerParameter.Hidden = true; 135 136 RegisterEventHandlers(); 137 129 138 Problem = new ClassificationProblem(); 130 139 } 140 141 private void RegisterEventHandlers() { 142 HiddenLayersParameter.Value.ValueChanged += HiddenLayersParameterValueValueChanged; 143 HiddenLayersParameter.ValueChanged += HiddenLayersParameterValueChanged; 144 } 145 131 146 [StorableHook(HookType.AfterDeserialization)] 132 private void AfterDeserialization() { } 147 private void AfterDeserialization() { 148 RegisterEventHandlers(); 149 } 133 150 134 151 public override IDeepCloneable Clone(Cloner cloner) { 135 152 return new NeuralNetworkClassification(this, cloner); 153 } 154 private void HiddenLayersParameterValueChanged(object source, EventArgs e) { 155 HiddenLayersParameter.Value.ValueChanged += HiddenLayersParameterValueValueChanged; 156 HiddenLayersParameterValueValueChanged(this, EventArgs.Empty); 157 } 158 159 private void HiddenLayersParameterValueValueChanged(object source, EventArgs e) { 160 if (HiddenLayers == 0) { 161 NodesInFirstHiddenLayerParameter.Hidden = true; 162 NodesInSecondHiddenLayerParameter.Hidden = true; 163 } else if (HiddenLayers == 1) { 164 NodesInFirstHiddenLayerParameter.Hidden = false; 165 NodesInSecondHiddenLayerParameter.Hidden = true; 166 } else { 167 NodesInFirstHiddenLayerParameter.Hidden = false; 168 NodesInSecondHiddenLayerParameter.Hidden = false; 169 } 136 170 } 137 171 -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs
r6649 r6720 127 127 public NeuralNetworkEnsembleClassification() 128 128 : base() { 129 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { new IntValue(0), new IntValue(1), new IntValue(2) }); 129 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 130 (IntValue)new IntValue(0).AsReadOnly(), 131 (IntValue)new IntValue(1).AsReadOnly(), 132 (IntValue)new IntValue(2).AsReadOnly() }); 130 133 var selectedHiddenLayerValue = (from v in validHiddenLayerValues 131 134 where v.Value == 1 … … 139 142 Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of restarts for learning.", new IntValue(2))); 140 143 144 HiddenLayersParameter.Hidden = true; 145 NodesInFirstHiddenLayerParameter.Hidden = true; 146 NodesInSecondHiddenLayerParameter.Hidden = true; 147 RestartsParameter.Hidden = true; 148 141 149 Problem = new ClassificationProblem(); 142 150 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs
r6649 r6720 127 127 public NeuralNetworkEnsembleRegression() 128 128 : base() { 129 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { new IntValue(0), new IntValue(1), new IntValue(2) }); 129 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 130 (IntValue)new IntValue(0).AsReadOnly(), 131 (IntValue)new IntValue(1).AsReadOnly(), 132 (IntValue)new IntValue(2).AsReadOnly() }); 130 133 var selectedHiddenLayerValue = (from v in validHiddenLayerValues 131 134 where v.Value == 1 … … 138 141 Parameters.Add(new FixedValueParameter<IntValue>(NodesInSecondHiddenLayerParameterName, "The number of nodes in the second hidden layer. This value is not used if the number of hidden layers is zero or one.", new IntValue(100))); 139 142 Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of restarts for learning.", new IntValue(2))); 143 144 HiddenLayersParameter.Hidden = true; 145 NodesInFirstHiddenLayerParameter.Hidden = true; 146 NodesInSecondHiddenLayerParameter.Hidden = true; 147 RestartsParameter.Hidden = true; 140 148 141 149 Problem = new RegressionProblem(); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs
r6719 r6720 113 113 private NeuralNetworkRegression(NeuralNetworkRegression original, Cloner cloner) 114 114 : base(original, cloner) { 115 RegisterEventHandlers(); 115 116 } 116 117 public NeuralNetworkRegression() 117 118 : base() { 118 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { new IntValue(0), new IntValue(1), new IntValue(2) }); 119 var validHiddenLayerValues = new ItemSet<IntValue>(new IntValue[] { 120 (IntValue)new IntValue(0).AsReadOnly(), 121 (IntValue)new IntValue(1).AsReadOnly(), 122 (IntValue)new IntValue(2).AsReadOnly() }); 119 123 var selectedHiddenLayerValue = (from v in validHiddenLayerValues 120 124 where v.Value == 1 … … 127 131 Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of restarts for learning.", new IntValue(2))); 128 132 133 RestartsParameter.Hidden = true; 134 NodesInSecondHiddenLayerParameter.Hidden = true; 135 136 RegisterEventHandlers(); 137 129 138 Problem = new RegressionProblem(); 130 139 } 140 141 private void RegisterEventHandlers() { 142 HiddenLayersParameter.Value.ValueChanged += HiddenLayersParameterValueValueChanged; 143 HiddenLayersParameter.ValueChanged += HiddenLayersParameterValueChanged; 144 } 145 131 146 [StorableHook(HookType.AfterDeserialization)] 132 private void AfterDeserialization() { } 147 private void AfterDeserialization() { 148 RegisterEventHandlers(); 149 } 133 150 134 151 public override IDeepCloneable Clone(Cloner cloner) { 135 152 return new NeuralNetworkRegression(this, cloner); 136 153 } 154 155 private void HiddenLayersParameterValueChanged(object source, EventArgs e) { 156 HiddenLayersParameter.Value.ValueChanged += HiddenLayersParameterValueValueChanged; 157 HiddenLayersParameterValueValueChanged(this, EventArgs.Empty); 158 } 159 160 private void HiddenLayersParameterValueValueChanged(object source, EventArgs e) { 161 if (HiddenLayers == 0) { 162 NodesInFirstHiddenLayerParameter.Hidden = true; 163 NodesInSecondHiddenLayerParameter.Hidden = true; 164 } else if (HiddenLayers == 1) { 165 NodesInFirstHiddenLayerParameter.Hidden = false; 166 NodesInSecondHiddenLayerParameter.Hidden = true; 167 } else { 168 NodesInFirstHiddenLayerParameter.Hidden = false; 169 NodesInSecondHiddenLayerParameter.Hidden = false; 170 } 171 } 172 137 173 138 174 #region neural network
Note: See TracChangeset
for help on using the changeset viewer.