Changeset 11205 for branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/CreateEnsembleMenuItem.cs
- Timestamp:
- 07/18/14 13:44:53 (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.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/CreateEnsembleMenuItem.cs
r11203 r11205 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. … … 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Windows.Forms; 26 using HeuristicLab.Core; 25 using HeuristicLab.Common; 27 26 using HeuristicLab.MainForm; 28 27 using HeuristicLab.MainForm.WindowsForms; … … 31 30 using HeuristicLab.Optimizer; 32 31 33 namespace HeuristicLab.Problems.DataAnalysis. MenuItems {32 namespace HeuristicLab.Problems.DataAnalysis.Views { 34 33 internal class CreateEnsembleMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 35 34 public override string Name { … … 37 36 } 38 37 public override IEnumerable<string> Structure { 39 get { return new string[] { "&Edit" }; }38 get { return new string[] { "&Edit", "&Data Analysis" }; } 40 39 } 41 40 public override int Position { 42 get { return 2500; }41 get { return 5100; } 43 42 } 44 43 public override string ToolTipText { … … 68 67 if (group.All(s => s is IRegressionSolution)) { 69 68 // show all regression ensembles 70 // clone problemdata (N.B. this assumes all solutions are based on the same problem data!) 71 var problemData = (RegressionProblemData)group 72 .OfType<IRegressionSolution>() 73 .First() 74 .ProblemData.Clone(); 69 // N.B. this assumes all solutions are based on the same problem data! 70 // the problem data is not cloned because the individual solutions were already cloned 71 var problemData = group.OfType<IRegressionSolution>().First().ProblemData; 75 72 var ensemble = new RegressionEnsembleSolution(problemData); 76 73 ensemble.Name = group.Key + " ensemble"; … … 81 78 } else if (group.All(s => s is IClassificationSolution)) { 82 79 // show all classification ensembles 83 var problemData = (ClassificationProblemData)group 84 .OfType<IClassificationSolution>() 85 .First() 86 .ProblemData.Clone(); 80 // N.B. this assumes all solutions are based on the same problem data! 81 // the problem data is not cloned because the individual solutions were already cloned 82 var problemData = (ClassificationProblemData)group.OfType<IClassificationSolution>().First().ProblemData; 87 83 var ensemble = new ClassificationEnsembleSolution(Enumerable.Empty<IClassificationModel>(), problemData); 88 84 ensemble.Name = group.Key + " ensemble"; … … 95 91 } 96 92 97 private IEnumerable<KeyValuePair<string, I Item>> GetDataAnalysisResults(IContentView view) {98 var empty = Enumerable.Empty<KeyValuePair<string, I Item>>();93 private IEnumerable<KeyValuePair<string, IDataAnalysisSolution>> GetDataAnalysisResults(IContentView view) { 94 var empty = Enumerable.Empty<KeyValuePair<string, IDataAnalysisSolution>>(); 99 95 if (view == null) return empty; 100 96 if (view.Content == null) return empty; … … 114 110 } 115 111 116 private IEnumerable<KeyValuePair<string, IItem>> GetDataAnalysisResults(IEnumerable<IRun> runs) { 112 private IEnumerable<KeyValuePair<string, IDataAnalysisSolution>> GetDataAnalysisResults(IEnumerable<IRun> runs) { 113 var cloner = new Cloner(); 117 114 var allResults = from r in runs 115 where r.Visible 118 116 select r.Results; 119 117 return from r in allResults 120 118 from result in r 121 let s = result.Value as IDataAnalysisSolution 122 where s != null 123 select result; 119 let solution = result.Value as IDataAnalysisSolution 120 where solution != null 121 let s = (IDataAnalysisSolution)cloner.Clone(result.Value) 122 select new KeyValuePair<string, IDataAnalysisSolution>(result.Key, s); 124 123 } 125 124 }
Note: See TracChangeset
for help on using the changeset viewer.