Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/01/11 13:49:59 (12 years ago)
Author:
mkommend
Message:

#1694: Corrected bugs in CrossValidation.

File:
1 edited

Legend:

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

    r6636 r7107  
    278278            int testEnd = (i + 1) == Folds.Value ? SamplesEnd.Value : (i + 1) * testSamplesCount + SamplesStart.Value;
    279279
     280            problem.ProblemData.TrainingPartition.Start = SamplesStart.Value;
     281            problem.ProblemData.TrainingPartition.End = SamplesEnd.Value;
    280282            problem.ProblemData.TestPartition.Start = testStart;
    281283            problem.ProblemData.TestPartition.End = testEnd;
     
    515517        throw new InvalidOperationException("Can not change number of folds if the execution state is not prepared.");
    516518    }
     519
     520    private bool samplesChanged = false;
    517521    private void SamplesStart_ValueChanged(object sender, EventArgs e) {
     522      samplesChanged = true;
    518523      if (Problem != null) Problem.ProblemData.TrainingPartition.Start = SamplesStart.Value;
     524      samplesChanged = false;
    519525    }
    520526    private void SamplesEnd_ValueChanged(object sender, EventArgs e) {
    521       if (Problem != null) Problem.ProblemData.TrainingPartition.End = SamplesEnd.Value;
     527      samplesChanged = true;
     528      if (Problem != null) problem.ProblemData.TrainingPartition.End = SamplesEnd.Value;
     529      samplesChanged = false;
    522530    }
    523531
     
    543551        throw new ArgumentException("A cross validation algorithm can only contain DataAnalysisProblems.");
    544552      }
    545       algorithm.Problem.Reset += (x,y) => OnProblemChanged();
     553      algorithm.Problem.Reset += (x, y) => OnProblemChanged();
    546554      problem = (IDataAnalysisProblem)algorithm.Problem;
    547555      OnProblemChanged();
     
    551559      EventHandler handler = ProblemChanged;
    552560      if (handler != null) handler(this, EventArgs.Empty);
     561      if (samplesChanged) return;
    553562
    554563      SamplesStart.Value = 0;
Note: See TracChangeset for help on using the changeset viewer.