Changeset 8965


Ignore:
Timestamp:
11/28/12 12:19:01 (10 years ago)
Author:
mkommend
Message:

#1917: Added missing event registration in AfterDeserialization of CrossValidation and clean up code if a problem changes in the crossvalidation. Additionally, I removed explicit calls to OnReset in the Load methods of IDataAnalysisProblems the reset event is automatically fired when the problem data is changed.

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r8962 r8965  
    7373      RegisterEvents();
    7474      if (Algorithm != null) RegisterAlgorithmEvents();
     75      if (Problem != null) Problem.Reset += (o, e) => OnProblemChanged();
    7576    }
    7677
     
    521522    private void RegisterEvents() {
    522523      Folds.ValueChanged += new EventHandler(Folds_ValueChanged);
    523       SamplesStart.ValueChanged += new EventHandler(SamplesStart_ValueChanged);
    524       SamplesEnd.ValueChanged += new EventHandler(SamplesEnd_ValueChanged);
    525524      RegisterClonedAlgorithmsEvents();
    526525    }
     
    530529    }
    531530
    532     private bool samplesChanged = false;
    533     private void SamplesStart_ValueChanged(object sender, EventArgs e) {
    534       samplesChanged = true;
    535       if (Problem != null) Problem.ProblemData.TrainingPartition.Start = SamplesStart.Value;
    536       samplesChanged = false;
    537     }
    538     private void SamplesEnd_ValueChanged(object sender, EventArgs e) {
    539       samplesChanged = true;
    540       if (Problem != null) Problem.ProblemData.TrainingPartition.End = SamplesEnd.Value;
    541       samplesChanged = false;
    542     }
    543531
    544532    #region template algorithms events
     
    571559      EventHandler handler = ProblemChanged;
    572560      if (handler != null) handler(this, EventArgs.Empty);
    573       if (samplesChanged) return;
    574561
    575562      SamplesStart.Value = 0;
     
    593580      } else
    594581        SamplesEnd.Value = 0;
    595 
    596       SamplesStart_ValueChanged(this, EventArgs.Empty);
    597       SamplesEnd_ValueChanged(this, EventArgs.Empty);
    598582    }
    599583
     
    689673      lock (locker) {
    690674        if (!stopPending && ExecutionState == ExecutionState.Started) {
    691           IAlgorithm preparedAlgorithm = clonedAlgorithms.Where(alg => alg.ExecutionState == ExecutionState.Prepared ||
    692                                                                        alg.ExecutionState == ExecutionState.Paused).FirstOrDefault();
     675          IAlgorithm preparedAlgorithm = clonedAlgorithms.FirstOrDefault(alg => alg.ExecutionState == ExecutionState.Prepared ||
     676                                                                                alg.ExecutionState == ExecutionState.Paused);
    693677          if (preparedAlgorithm != null) preparedAlgorithm.Start();
    694678        }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r8936 r8965  
    357357      Description = data.Description;
    358358      ProblemData = data;
    359       OnReset();
    360359    }
    361360
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblem.cs

    r8798 r8965  
    102102      Description = data.Description;
    103103      ProblemData = data;
    104       OnReset();
    105104    }
    106105
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs

    r7259 r8965  
    7373
    7474    public void Add(double x) {
    75       if (double.IsNaN(x) || double.IsInfinity(x) || x > 1E13 || x < -1E13 || (errorState & OnlineCalculatorError.InvalidValueAdded) > 0) {
     75      if (double.IsNaN(x) || double.IsInfinity(x) || (errorState & OnlineCalculatorError.InvalidValueAdded) > 0) {
    7676        errorState = errorState | OnlineCalculatorError.InvalidValueAdded;
    7777        varianceErrorState = errorState | OnlineCalculatorError.InvalidValueAdded;
Note: See TracChangeset for help on using the changeset viewer.