Ignore:
Timestamp:
09/20/18 15:27:44 (3 years ago)
Author:
gkronber
Message:

#2891: incorporated feedback from review, made NeuralNetworkEnsembleModel and NeuralNetworkModel readonly. This is a breaking change to the API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleModel.cs

    r15739 r16168  
    3636  public sealed class NeuralNetworkEnsembleModel : ClassificationModel, INeuralNetworkEnsembleModel {
    3737
     38    private object mlpEnsembleLocker = new object();
    3839    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     }
    4940
    5041    public override IEnumerable<string> VariablesUsedForPrediction {
     
    10394        }
    10495        // mlpeprocess writes data in mlpEnsemble and is therefore not thread-safe
    105         lock (mlpEnsemble) {
     96        lock (mlpEnsembleLocker) {
    10697          alglib.mlpeprocess(mlpEnsemble, x, ref y);
    10798        }
     
    123114        }
    124115        // mlpeprocess writes data in mlpEnsemble and is therefore not thread-safe
    125         lock (mlpEnsemble) {
     116        lock (mlpEnsembleLocker) {
    126117          alglib.mlpeprocess(mlpEnsemble, x, ref y);
    127118        }
     
    145136      return new NeuralNetworkEnsembleClassificationSolution(this, new ClassificationEnsembleProblemData(problemData));
    146137    }
    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   
    157139    #region persistence
    158140    [Storable]
Note: See TracChangeset for help on using the changeset viewer.