Changeset 11202 for branches/HiveStatistics/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
- Timestamp:
- 07/18/14 12:01:13 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r8970 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 266 266 } 267 267 268 private bool startPending;269 268 public void Start() { 270 269 if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused)) 271 270 throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState)); 272 271 273 if (Algorithm != null && !startPending) { 274 startPending = true; 272 if (Algorithm != null) { 275 273 //create cloned algorithms 276 274 if (clonedAlgorithms.Count == 0) { … … 335 333 if (!pausePending) { 336 334 pausePending = true; 337 if (!startPending)PauseAllClonedAlgorithms();335 PauseAllClonedAlgorithms(); 338 336 } 339 337 } … … 352 350 if (!stopPending) { 353 351 stopPending = true; 354 if (!startPending)StopAllClonedAlgorithms();352 StopAllClonedAlgorithms(); 355 353 } 356 354 } … … 389 387 390 388 private void AggregateResultValues(IDictionary<string, IItem> results) { 391 Dictionary<string, List<double>> resultValues = new Dictionary<string, List<double>>();392 389 IEnumerable<IRun> runs = clonedAlgorithms.Select(alg => alg.Runs.FirstOrDefault()).Where(run => run != null); 393 390 IEnumerable<KeyValuePair<string, IItem>> resultCollections = runs.Where(x => x != null).SelectMany(x => x.Results).ToList(); … … 552 549 } 553 550 if (problem != null) problem.Reset -= new EventHandler(Problem_Reset); 554 if (Problem != null) Problem.Reset += new EventHandler(Problem_Reset);555 551 problem = (IDataAnalysisProblem)algorithm.Problem; 552 if (problem != null) problem.Reset += new EventHandler(Problem_Reset); 556 553 OnProblemChanged(); 557 554 } … … 653 650 654 651 private readonly object locker = new object(); 652 private readonly object resultLocker = new object(); 655 653 private void ClonedAlgorithm_Started(object sender, EventArgs e) { 656 lock (locker) {657 IAlgorithm algorithm = sender as IAlgorithm;654 IAlgorithm algorithm = sender as IAlgorithm; 655 lock (resultLocker) { 658 656 if (algorithm != null && !results.ContainsKey(algorithm.Name)) 659 657 results.Add(new Result(algorithm.Name, "Contains results for the specific fold.", algorithm.Results)); 660 661 if (startPending) {662 int startedAlgorithms = clonedAlgorithms.Count(alg => alg.ExecutionState == ExecutionState.Started);663 if (startedAlgorithms == NumberOfWorkers.Value ||664 clonedAlgorithms.All(alg => alg.ExecutionState != ExecutionState.Prepared))665 startPending = false;666 667 if (pausePending) PauseAllClonedAlgorithms();668 if (stopPending) StopAllClonedAlgorithms();669 }670 658 } 671 659 } … … 718 706 public event EventHandler Started; 719 707 private void OnStarted() { 720 startPending = false;721 708 ExecutionState = ExecutionState.Started; 722 709 EventHandler handler = Started;
Note: See TracChangeset
for help on using the changeset viewer.