Changeset 7866
- Timestamp:
- 05/22/12 10:36:20 (12 years ago)
- Location:
- branches/ClassificationEnsembleVoting
- Files:
-
- 3 deleted
- 23 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
r7562 r7866 57 57 matrixView.DataGridView.RowPrePaint += new DataGridViewRowPrePaintEventHandler(DataGridView_RowPrePaint); 58 58 } 59 60 61 59 62 60 private void SamplesComboBox_SelectedIndexChanged(object sender, EventArgs e) { -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r7729 r7866 161 161 </Compile> 162 162 <Compile Include="Plugin.cs" /> 163 <Compile Include="Regression\RegressionEnsembleSolutionModelView.cs"> 164 <SubType>UserControl</SubType> 165 </Compile> 166 <Compile Include="Regression\RegressionEnsembleSolutionModelView.Designer.cs"> 167 <DependentUpon>RegressionEnsembleSolutionModelView.cs</DependentUpon> 168 </Compile> 163 169 <Compile Include="Regression\RegressionSolutionErrorCharacteristicsCurveView.cs"> 164 170 <SubType>UserControl</SubType> … … 167 173 <DependentUpon>RegressionSolutionErrorCharacteristicsCurveView.cs</DependentUpon> 168 174 </Compile> 169 <Compile Include="Regression\RegressionEnsembleSolutionModelView.cs"> 170 <SubType>UserControl</SubType> 171 </Compile> 172 <Compile Include="Regression\RegressionEnsembleSolutionModelView.Designer.cs"> 173 <DependentUpon>RegressionEnsembleSolutionModelView.cs</DependentUpon> 175 <Compile Include="Regression\RegressionSolutionEstimatedValuesView.cs"> 176 <SubType>UserControl</SubType> 177 </Compile> 178 <Compile Include="Regression\RegressionSolutionEstimatedValuesView.Designer.cs"> 179 <DependentUpon>RegressionSolutionEstimatedValuesView.cs</DependentUpon> 180 </Compile> 181 <Compile Include="Regression\RegressionSolutionLineChartView.cs"> 182 <SubType>UserControl</SubType> 183 </Compile> 184 <Compile Include="Regression\RegressionSolutionLineChartView.Designer.cs"> 185 <DependentUpon>RegressionSolutionLineChartView.cs</DependentUpon> 186 </Compile> 187 <Compile Include="Regression\RegressionSolutionResidualHistogram.cs"> 188 <SubType>UserControl</SubType> 189 </Compile> 190 <Compile Include="Regression\RegressionSolutionResidualHistogram.Designer.cs"> 191 <DependentUpon>RegressionSolutionResidualHistogram.cs</DependentUpon> 192 </Compile> 193 <Compile Include="Regression\RegressionSolutionScatterPlotView.cs"> 194 <SubType>UserControl</SubType> 195 </Compile> 196 <Compile Include="Regression\RegressionSolutionScatterPlotView.Designer.cs"> 197 <DependentUpon>RegressionSolutionScatterPlotView.cs</DependentUpon> 174 198 </Compile> 175 199 <Compile Include="Solution Views\ClassificationSolutionView.cs"> … … 265 289 <DependentUpon>RegressionSolutionView.cs</DependentUpon> 266 290 </Compile> 267 <Compile Include="Regression\RegressionSolutionEstimatedValuesView.cs">268 <SubType>UserControl</SubType>269 </Compile>270 <Compile Include="Regression\RegressionSolutionEstimatedValuesView.Designer.cs">271 <DependentUpon>RegressionSolutionEstimatedValuesView.cs</DependentUpon>272 </Compile>273 <Compile Include="Regression\RegressionSolutionLineChartView.cs">274 <SubType>UserControl</SubType>275 </Compile>276 <Compile Include="Regression\RegressionSolutionLineChartView.Designer.cs">277 <DependentUpon>RegressionSolutionLineChartView.cs</DependentUpon>278 </Compile>279 <Compile Include="Regression\RegressionSolutionScatterPlotView.cs">280 <SubType>UserControl</SubType>281 </Compile>282 <Compile Include="Regression\RegressionSolutionScatterPlotView.Designer.cs">283 <DependentUpon>RegressionSolutionScatterPlotView.cs</DependentUpon>284 </Compile>285 291 <None Include="HeuristicLab.snk" /> 286 292 <None Include="Plugin.cs.frame" /> 287 293 <None Include="Properties\AssemblyInfo.cs.frame" /> 288 <Compile Include="DataAnalysisProblemView.cs">289 <SubType>UserControl</SubType>290 </Compile>291 <Compile Include="DataAnalysisProblemView.Designer.cs">292 <DependentUpon>DataAnalysisProblemView.cs</DependentUpon>293 </Compile>294 294 <Compile Include="Properties\AssemblyInfo.cs" /> 295 295 </ItemGroup> … … 317 317 <Install>true</Install> 318 318 </BootstrapperPackage> 319 </ItemGroup> 320 <ItemGroup> 321 <Folder Include="obj\" /> 319 322 </ItemGroup> 320 323 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/CreateEnsembleMenuItem.cs
r7259 r7866 73 73 .First() 74 74 .ProblemData.Clone(); 75 var ensemble = new RegressionEnsembleSolution( Enumerable.Empty<IRegressionModel>(),problemData);75 var ensemble = new RegressionEnsembleSolution(problemData); 76 76 ensemble.Name = group.Key + " ensemble"; 77 77 var nestedSolutions = group.OfType<RegressionEnsembleSolution>().SelectMany(e => e.RegressionSolutions); -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.Designer.cs
r7043 r7866 49 49 this.chart.TabIndex = 0; 50 50 this.chart.Text = "chart"; 51 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 51 this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Chart_MouseDoubleClick); 52 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 52 53 // 53 54 // label1 -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
r7259 r7866 27 27 using HeuristicLab.MainForm; 28 28 using HeuristicLab.MainForm.WindowsForms; 29 29 30 namespace HeuristicLab.Problems.DataAnalysis.Views { 30 31 [View("Error Characteristics Curve")] … … 104 105 var originalValues = GetOriginalValues().ToList(); 105 106 constantModel = CreateConstantModel(); 106 var meanModelEstimatedValues = GetEstimatedValues(constantModel);107 var meanModelResiduals = GetResiduals(originalValues, meanModelEstimatedValues);108 109 meanModelResiduals.Sort();110 chart.ChartAreas[0].AxisX.Maximum = Math.Ceiling( meanModelResiduals.Last());111 chart.ChartAreas[0].CursorX.Interval = meanModelResiduals.First() / 100;112 113 Series meanModelSeries = new Series("Mean Model");114 meanModelSeries.ChartType = SeriesChartType.FastLine;115 UpdateSeries( meanModelResiduals, meanModelSeries);116 meanModelSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(meanModelSeries);117 meanModelSeries.Tag = constantModel;118 chart.Series.Add( meanModelSeries);107 var baselineEstimatedValues = GetEstimatedValues(constantModel); 108 var baselineResiduals = GetResiduals(originalValues, baselineEstimatedValues); 109 110 baselineResiduals.Sort(); 111 chart.ChartAreas[0].AxisX.Maximum = Math.Ceiling(baselineResiduals.Last()); 112 chart.ChartAreas[0].CursorX.Interval = baselineResiduals.First() / 100; 113 114 Series baselineSeries = new Series("Baseline"); 115 baselineSeries.ChartType = SeriesChartType.FastLine; 116 UpdateSeries(baselineResiduals, baselineSeries); 117 baselineSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(baselineSeries); 118 baselineSeries.Tag = constantModel; 119 chart.Series.Add(baselineSeries); 119 120 120 121 AddRegressionSolution(Content); … … 200 201 } 201 202 202 protected IEnumerable<double> Get MeanModelEstimatedValues(IEnumerable<double> originalValues) {203 protected IEnumerable<double> GetbaselineEstimatedValues(IEnumerable<double> originalValues) { 203 204 double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average(); 204 205 return Enumerable.Repeat(averageTrainingTarget, originalValues.Count()); … … 229 230 } 230 231 231 #region Mean Model 232 private void chart_MouseDown(object sender, MouseEventArgs e) { 233 if (e.Clicks < 2) return; 232 #region Baseline 233 private void Chart_MouseDoubleClick(object sender, MouseEventArgs e) { 234 234 HitTestResult result = chart.HitTest(e.X, e.Y); 235 235 if (result.ChartElementType != ChartElementType.LegendItem) return; 236 if (result.Series.Name != constantModel.Name) return;237 236 238 237 MainFormManager.MainForm.ShowContent((IRegressionSolution)result.Series.Tag); … … 242 241 double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average(); 243 242 var solution = new ConstantRegressionModel(averageTrainingTarget).CreateRegressionSolution(ProblemData); 244 solution.Name = " Mean Model";243 solution.Name = "Baseline"; 245 244 return solution; 246 245 } 247 246 #endregion 247 248 private void chart_MouseMove(object sender, MouseEventArgs e) { 249 HitTestResult result = chart.HitTest(e.X, e.Y); 250 if (result.ChartElementType == ChartElementType.LegendItem) 251 Cursor = Cursors.Hand; 252 else 253 Cursor = Cursors.Default; 254 } 248 255 } 249 256 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationEnsembleSolutionView.cs
r7549 r7866 51 51 if (cmbWeightCalculator.Items.Count == 0) { 52 52 cmbWeightCalculator.Items.AddRange(ApplicationManager.Manager.GetInstances<IClassificationEnsembleSolutionWeightCalculator>().OrderBy(b => b.Name, new NaturalStringComparer()).ToArray()); 53 if (cmbWeightCalculator.Items.Count > 0) 53 if (cmbWeightCalculator.Items.Count > 0) { 54 54 cmbWeightCalculator.SelectedIndex = 0; 55 } 55 56 } else { 56 57 Content.WeightCalculator = (IClassificationEnsembleSolutionWeightCalculator)cmbWeightCalculator.SelectedItem; … … 59 60 60 61 protected void cmbWeightCalculator_SelectedIndexChanged(object sender, System.EventArgs e) { 61 if (cmbWeightCalculator.SelectedItem != null) 62 if (cmbWeightCalculator.SelectedItem != null) { 62 63 Content.WeightCalculator = (IClassificationEnsembleSolutionWeightCalculator)cmbWeightCalculator.SelectedItem; 64 } 63 65 } 64 66 -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r7259 r7866 72 72 rows = variableValues.First().Count; 73 73 this.variableNames = new List<string>(variableNames); 74 this.variableValues = new Dictionary<string, IList>( );74 this.variableValues = new Dictionary<string, IList>(this.variableNames.Count); 75 75 for (int i = 0; i < this.variableNames.Count; i++) { 76 76 var values = variableValues.ElementAt(i); … … 107 107 this.variableNames = new List<string>(variableNames); 108 108 109 this.variableValues = new Dictionary<string, IList>( );109 this.variableValues = new Dictionary<string, IList>(variableValues.GetLength(1)); 110 110 for (int col = 0; col < variableValues.GetLength(1); col++) { 111 111 string columName = this.variableNames[col]; 112 var values = new List<double>( );112 var values = new List<double>(variableValues.GetLength(0)); 113 113 for (int row = 0; row < variableValues.GetLength(0); row++) { 114 114 values.Add(variableValues[row, col]); -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r7729 r7866 120 120 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 121 121 </Reference> 122 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 123 <Private>False</Private> 124 </Reference> 122 125 <Reference Include="System" /> 123 126 <Reference Include="System.Core"> … … 179 182 <Compile Include="Interfaces\Regression\IRegressionEnsembleSolution.cs" /> 180 183 <Compile Include="Implementation\Regression\RegressionSolutionBase.cs" /> 184 <Compile Include="OnlineCalculators\OnlineMaxAbsoluteErrorCalculator.cs" /> 181 185 <Compile Include="OnlineCalculators\OnlineMeanErrorCalculator.cs" /> 182 186 <Compile Include="OnlineCalculators\NormalizedGiniCalculator.cs" /> … … 217 221 <Compile Include="Implementation\Regression\RegressionSolution.cs" /> 218 222 <Compile Include="Plugin.cs" /> 219 <Compile Include="TableFileParser.cs" />220 223 <Compile Include="Implementation\Classification\ThresholdCalculators\AccuracyMaximizationThresholdCalculator.cs" /> 221 224 <Compile Include="Implementation\Classification\ThresholdCalculators\NormalDistributionCutPointsThresholdCalculator.cs" /> -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblem.cs
r7259 r7866 40 40 ProblemData = new ClassificationProblemData(); 41 41 } 42 43 public override void ImportProblemDataFromFile(string fileName) {44 ClassificationProblemData problemData = ClassificationProblemData.ImportFromFile(fileName);45 ProblemData = problemData;46 }47 42 } 48 43 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs
r7266 r7866 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.IO;25 24 using System.Linq; 26 25 using HeuristicLab.Common; … … 403 402 } 404 403 #endregion 405 406 #region Import from file407 public static ClassificationProblemData ImportFromFile(string fileName) {408 TableFileParser csvFileParser = new TableFileParser();409 csvFileParser.Parse(fileName);410 411 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);412 dataset.Name = Path.GetFileName(fileName);413 414 ClassificationProblemData problemData = new ClassificationProblemData(dataset, dataset.DoubleVariables.Skip(1), dataset.DoubleVariables.First());415 problemData.Name = "Data imported from " + Path.GetFileName(fileName);416 return problemData;417 }418 #endregion419 404 } 420 405 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MajorityVoteWeightCalculator.cs
r7549 r7866 51 51 return Enumerable.Repeat<double>(1, classificationSolutions.Count()); 52 52 } 53 54 public override double GetConfidence(IEnumerable<IClassificationSolution> solutions, int index, double estimatedClassValue) { 55 if (solutions.Count() < 1) 56 return double.NaN; 57 Dataset dataset = solutions.First().ProblemData.Dataset; 58 int correctEstimated = solutions.Select(s => s.Model.GetEstimatedClassValues(dataset, Enumerable.Repeat(index, 1)).First()) 59 .Where(x => x.Equals(estimatedClassValue)) 60 .Count(); 61 return ((double)correctEstimated / (double)solutions.Count() - 0.5) * 2; 62 } 53 63 } 54 64 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringProblem.cs
r7259 r7866 38 38 ProblemData = new ClusteringProblemData(); 39 39 } 40 41 public override void ImportProblemDataFromFile(string fileName) {42 ClusteringProblemData problemData = ClusteringProblemData.ImportFromFile(fileName);43 ProblemData = problemData;44 }45 40 } 46 41 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringProblemData.cs
r7259 r7866 21 21 22 22 using System.Collections.Generic; 23 using System.IO;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; … … 90 89 : base(dataset, allowedInputVariables) { 91 90 } 92 93 94 #region Import from file95 public static ClusteringProblemData ImportFromFile(string fileName) {96 TableFileParser csvFileParser = new TableFileParser();97 csvFileParser.Parse(fileName);98 99 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);100 dataset.Name = Path.GetFileName(fileName);101 102 ClusteringProblemData problemData = new ClusteringProblemData(dataset, dataset.DoubleVariables);103 problemData.Name = "Data imported from " + Path.GetFileName(fileName);104 return problemData;105 }106 #endregion107 91 } 108 92 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblem.cs
r7259 r7866 26 26 using HeuristicLab.Parameters; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Problems.Instances; 28 29 29 30 namespace HeuristicLab.Problems.DataAnalysis { 30 31 [StorableClass] 31 public abstract class DataAnalysisProblem<T> : Problem, 32 I DataAnalysisProblem<T>32 public abstract class DataAnalysisProblem<T> : Problem, IDataAnalysisProblem<T>, 33 IProblemInstanceConsumer<T>, IProblemInstanceExporter<T> 33 34 where T : class, IDataAnalysisProblemData { 34 35 private const string ProblemDataParameterName = "ProblemData"; … … 91 92 } 92 93 93 public abstract void ImportProblemDataFromFile(string fileName); 94 #region Import & Export 95 public void Load(T data) { 96 Name = data.Name; 97 Description = data.Description; 98 ProblemData = data; 99 OnReset(); 100 } 101 102 public T Export() { 103 return ProblemData; 104 } 105 #endregion 94 106 } 95 107 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
r7259 r7866 97 97 98 98 RegisterRegressionSolutionsEventHandler(); 99 } 100 101 public RegressionEnsembleSolution(IRegressionProblemData problemData) 102 : this(Enumerable.Empty<IRegressionModel>(), problemData) { 99 103 } 100 104 -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblem.cs
r7259 r7866 40 40 ProblemData = new RegressionProblemData(); 41 41 } 42 43 public override void ImportProblemDataFromFile(string fileName) {44 RegressionProblemData problemData = RegressionProblemData.ImportFromFile(fileName);45 ProblemData = problemData;46 }47 42 } 48 43 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r7259 r7866 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.IO;25 24 using System.Linq; 26 25 using HeuristicLab.Common; … … 136 135 OnChanged(); 137 136 } 138 139 #region Import from file140 public static RegressionProblemData ImportFromFile(string fileName) {141 TableFileParser csvFileParser = new TableFileParser();142 csvFileParser.Parse(fileName);143 144 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);145 dataset.Name = Path.GetFileName(fileName);146 147 RegressionProblemData problemData = new RegressionProblemData(dataset, dataset.DoubleVariables.Skip(1), dataset.DoubleVariables.First());148 problemData.Name = "Data imported from " + Path.GetFileName(fileName);149 return problemData;150 }151 #endregion152 137 } 153 138 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
r7259 r7866 44 44 protected RegressionSolution(IRegressionModel model, IRegressionProblemData problemData) 45 45 : base(model, problemData) { 46 evaluationCache = new Dictionary<int, double>( );46 evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows); 47 47 } 48 48 -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs
r7272 r7866 21 21 22 22 using System.Collections.Generic; 23 using System.Linq;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Data; … … 166 165 167 166 protected void CalculateResults() { 168 double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values169 double[] originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToArray();170 double[] estimatedTestValues = EstimatedTestValues.ToArray(); // cache values171 double[] originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes).ToArray();167 IEnumerable<double> estimatedTrainingValues = EstimatedTrainingValues; // cache values 168 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes); 169 IEnumerable<double> estimatedTestValues = EstimatedTestValues; // cache values 170 IEnumerable<double> originalTestValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TestIndizes); 172 171 173 172 OnlineCalculatorError errorState; -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblem.cs
r7259 r7866 29 29 IDataAnalysisProblemData ProblemData { get; } 30 30 event EventHandler ProblemDataChanged; 31 32 void ImportProblemDataFromFile(string fileName);33 31 } 34 32 -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Plugin.cs.frame
r7259 r7866 36 36 [PluginDependency("HeuristicLab.Parameters", "3.3")] 37 37 [PluginDependency("HeuristicLab.Persistence", "3.3")] 38 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 38 39 public class HeuristicLabProblemsDataAnalysisPlugin : PluginBase { 39 40 }
Note: See TracChangeset
for help on using the changeset viewer.