Changeset 10593
- Timestamp:
- 03/12/14 21:06:17 (11 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 10526
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged: 10526
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/CreateEnsembleMenuItem.cs
r9999 r10593 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; … … 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 118 115 select r.Results; 119 116 return from r in allResults 120 117 from result in r 121 let s = result.Valueas IDataAnalysisSolution118 let s = cloner.Clone(result.Value) as IDataAnalysisSolution 122 119 where s != null 123 select result;120 select new KeyValuePair<string, IDataAnalysisSolution>(result.Key, s); 124 121 } 125 122 }
Note: See TracChangeset
for help on using the changeset viewer.