Changeset 575
- Timestamp:
- 09/15/08 13:19:09 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Charting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Charting/Histogram.cs
r573 r575 32 32 private static readonly Color defaultColor = Color.Blue; 33 33 private static readonly Color selectionColor = Color.Red; 34 private static readonly Pen defaultPen = new Pen(defaultColor); 35 private static readonly Brush defaultBrush = defaultPen.Brush; 36 private static readonly Pen selectionPen = new Pen(selectionColor); 37 private static readonly Brush selectionBrush = selectionPen.Brush; 34 38 35 39 private double minX; … … 43 47 private Dictionary<Record, IPrimitive> recordToPrimitiveDictionary; 44 48 private Group bars; 45 private double[] limits;46 private int[] buckets;47 49 private string dimension; 48 50 … … 62 64 results.OnRecordAdded += new EventHandler<RecordAddedEventArgs>(results_OnRecordAdded); 63 65 results.Changed += new EventHandler(results_Changed); 64 limits = new double[N_BUCKETS - 1];65 buckets = new int[N_BUCKETS];66 66 } 67 67 68 68 void results_Changed(object sender, EventArgs e) { 69 ResetViewSize(); 69 70 Repaint(); 70 71 EnforceUpdate(); … … 96 97 Group.Add(new Axis(this, 0, 0, AxisType.Both)); 97 98 UpdateViewSize(0, 0); 98 Pen defaultPen = new Pen(defaultColor); 99 Brush defaultBrush = defaultPen.Brush; 100 PaintHistogram(records, defaultPen, defaultBrush); 101 Pen selectionPen = new Pen(selectionColor); 102 Brush selectionBrush = selectionPen.Brush; 103 PaintHistogram(records.Where(r => r.Selected), selectionPen, selectionBrush); 99 PaintHistogram(records); 104 100 Group.Add(bars); 105 101 UpdateEnabled = true; … … 107 103 } 108 104 109 private void PaintHistogram(IEnumerable<Record> records , Pen pen, Brush brush) {105 private void PaintHistogram(IEnumerable<Record> records) { 110 106 var values = records.Select(r => new { Record = r, Value = r.Get(dimension) }).Where( 111 107 x => !double.IsNaN(x.Value) && !double.IsInfinity(x.Value) && x.Value != double.MinValue && x.Value != double.MaxValue).OrderBy(x => x.Value); … … 121 117 foreach(var g in frequencies) { 122 118 double freq = g.Count(); 119 double selectedFreq = g.Where(r=>r.Record.Selected).Count(); 123 120 double lower = g.Key; 124 121 double upper = g.Key + bucketSize; 125 HeuristicLab.Charting.Rectangle bar = new HeuristicLab.Charting.Rectangle(this, lower, 0, upper, freq, pen, brush);122 HeuristicLab.Charting.Rectangle bar = new HeuristicLab.Charting.Rectangle(this, lower, 0, upper, freq, defaultPen, defaultBrush); 126 123 primitiveToRecordsDictionary[bar] = g.Select(r => r.Record).ToList(); 127 124 primitiveToRecordsDictionary[bar].ForEach(x => recordToPrimitiveDictionary[x] = bar); 128 if(lower == frequencies.First().Key) bar.ToolTipText = " x < " + upper + " : " + freq; 129 else if(lower == frequencies.Last().Key) bar.ToolTipText = "x >= " + lower + " : " + freq; 130 else bar.ToolTipText = "x in [" + lower + " .. " + upper + "[ : " + freq; 125 HeuristicLab.Charting.Rectangle selectedBar = new HeuristicLab.Charting.Rectangle(this, lower, 0, upper, selectedFreq, selectionPen, selectionBrush); 126 primitiveToRecordsDictionary[selectedBar] = g.Select(r => r.Record).Where(r=>r.Selected).ToList(); 127 primitiveToRecordsDictionary[selectedBar].ForEach(x => recordToPrimitiveDictionary[x] = bar); 128 if(lower == frequencies.First().Key) { 129 selectedBar.ToolTipText = " x < " + upper + " : " + selectedFreq; 130 bar.ToolTipText = " x < " + upper + " : " + freq; 131 } else if(lower == frequencies.Last().Key) { 132 selectedBar.ToolTipText = "x >= " + lower + " : " + selectedFreq; 133 bar.ToolTipText = "x >= " + lower + " : " + freq; 134 } else { 135 selectedBar.ToolTipText = "x in [" + lower + " .. " + upper + "[ : " + selectedFreq; 136 bar.ToolTipText = "x in [" + lower + " .. " + upper + "[ : " + freq; 137 } 131 138 bars.Add(bar); 139 bars.Add(selectedBar); 132 140 UpdateViewSize(lower, freq); 133 141 UpdateViewSize(upper, freq); -
trunk/sources/HeuristicLab.CEDMA.Charting/Record.cs
r573 r575 64 64 public const string TREE_SIZE = "Tree size"; 65 65 public const string TREE_HEIGHT = "Tree height"; 66 public const string SELECTIONPRESSURE = "Selection pressure"; 66 67 67 68 public const string X_JITTER = "__X_JITTER"; -
trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs
r567 r575 60 60 private readonly Entity treeSizePredicate = new Entity(cedmaNS + "TreeSize"); 61 61 private readonly Entity treeHeightPredicate = new Entity(cedmaNS + "TreeHeight"); 62 private readonly Entity rawDataPredicate = new Entity(cedmaNS + "rawData"); 63 private readonly Entity hasModelPredicate = new Entity(cedmaNS + "hasModel"); 62 private readonly Entity selectionPressurePredicate = new Entity(cedmaNS + "SelectionPressure"); 63 private readonly Entity rawDataPredicate = new Entity(cedmaNS + "RawData"); 64 private readonly Entity hasModelPredicate = new Entity(cedmaNS + "Model"); 64 65 private readonly Entity anyEntity = new Entity(null); 65 66 private Dictionary<Record, Dataset> datasets; … … 75 76 } 76 77 77 private List<string> variableNames = new List<string>() { Record.TARGET_VARIABLE, Record.TREE_SIZE, Record.TREE_HEIGHT, 78 private List<string> variableNames = new List<string>() { Record.TARGET_VARIABLE, Record.TREE_SIZE, Record.TREE_HEIGHT, Record.SELECTIONPRESSURE, 78 79 Record.MAPE_TRAINING, Record.MAPE_VALIDATION, Record.MAPE_TEST, 79 80 Record.R2_TRAINING, Record.R2_VALIDATION, Record.R2_TEST}; … … 102 103 .Select(x => store.Select(new SelectFilter( 103 104 new Entity[] { new Entity(x.Subject.Uri) }, 104 new Entity[] { targetVariablePredicate, treeSizePredicate, treeHeightPredicate, 105 new Entity[] { targetVariablePredicate, treeSizePredicate, treeHeightPredicate, selectionPressurePredicate, 105 106 trainingMAPEPredicate, validationMAPEPredicate, testMAPEPredicate, 106 107 trainingR2Predicate, validationR2Predicate, testR2Predicate }, … … 145 146 predicateToVariableName[treeSizePredicate] = Record.TREE_SIZE; 146 147 predicateToVariableName[treeHeightPredicate] = Record.TREE_HEIGHT; 148 predicateToVariableName[selectionPressurePredicate] = Record.SELECTIONPRESSURE; 147 149 predicateToVariableName[trainingMAPEPredicate] = Record.MAPE_TRAINING; 148 150 predicateToVariableName[validationMAPEPredicate] = Record.MAPE_VALIDATION;
Note: See TracChangeset
for help on using the changeset viewer.