Changeset 16168 for trunk/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 09/20/18 15:27:44 (6 years ago)
- Location:
- trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleModel.cs
r15739 r16168 36 36 public sealed class NeuralNetworkEnsembleModel : ClassificationModel, INeuralNetworkEnsembleModel { 37 37 38 private object mlpEnsembleLocker = new object(); 38 39 private alglib.mlpensemble mlpEnsemble; 39 public alglib.mlpensemble MultiLayerPerceptronEnsemble {40 get { return mlpEnsemble; }41 set {42 if (value != mlpEnsemble) {43 if (value == null) throw new ArgumentNullException();44 mlpEnsemble = value;45 OnChanged(EventArgs.Empty);46 }47 }48 }49 40 50 41 public override IEnumerable<string> VariablesUsedForPrediction { … … 103 94 } 104 95 // mlpeprocess writes data in mlpEnsemble and is therefore not thread-safe 105 lock (mlpEnsemble ) {96 lock (mlpEnsembleLocker) { 106 97 alglib.mlpeprocess(mlpEnsemble, x, ref y); 107 98 } … … 123 114 } 124 115 // mlpeprocess writes data in mlpEnsemble and is therefore not thread-safe 125 lock (mlpEnsemble ) {116 lock (mlpEnsembleLocker) { 126 117 alglib.mlpeprocess(mlpEnsemble, x, ref y); 127 118 } … … 145 136 return new NeuralNetworkEnsembleClassificationSolution(this, new ClassificationEnsembleProblemData(problemData)); 146 137 } 147 148 #region events 149 public event EventHandler Changed; 150 private void OnChanged(EventArgs e) { 151 var handlers = Changed; 152 if (handlers != null) 153 handlers(this, e); 154 } 155 #endregion 156 138 157 139 #region persistence 158 140 [Storable] -
trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkModel.cs
r15739 r16168 36 36 public sealed class NeuralNetworkModel : ClassificationModel, INeuralNetworkModel { 37 37 38 private object mlpLocker = new object(); 38 39 private alglib.multilayerperceptron multiLayerPerceptron; 39 public alglib.multilayerperceptron MultiLayerPerceptron {40 get { return multiLayerPerceptron; }41 set {42 if (value != multiLayerPerceptron) {43 if (value == null) throw new ArgumentNullException();44 multiLayerPerceptron = value;45 OnChanged(EventArgs.Empty);46 }47 }48 }49 40 50 41 public override IEnumerable<string> VariablesUsedForPrediction { … … 107 98 } 108 99 // NOTE: mlpprocess changes data in multiLayerPerceptron and is therefore not thread-save! 109 lock (m ultiLayerPerceptron) {100 lock (mlpLocker) { 110 101 alglib.mlpprocess(multiLayerPerceptron, x, ref y); 111 102 } … … 127 118 } 128 119 // NOTE: mlpprocess changes data in multiLayerPerceptron and is therefore not thread-save! 129 lock (m ultiLayerPerceptron) {120 lock (mlpLocker) { 130 121 alglib.mlpprocess(multiLayerPerceptron, x, ref y); 131 122 } … … 150 141 } 151 142 152 #region events153 public event EventHandler Changed;154 private void OnChanged(EventArgs e) {155 var handlers = Changed;156 if (handlers != null)157 handlers(this, e);158 }159 #endregion160 161 143 #region persistence 162 144 [Storable]
Note: See TracChangeset
for help on using the changeset viewer.