Changeset 2295
- Timestamp:
- 08/18/09 18:17:04 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChart.cs
r2289 r2295 71 71 this.sizeDimension = dimension; 72 72 this.invertSize = inverted; 73 Refresh(); 74 } 75 76 public void Refresh() { 73 77 Repaint(); 74 78 EnforceUpdate(); … … 133 137 } else if (matrix.MultiDimensionalCategoricalVariables.Contains(xDimension)) { 134 138 var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 135 IEnumerable< VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));136 foreach ( VisualMatrixRow subRow in subRows) {139 IEnumerable<MatrixRow> subRows = (IEnumerable<MatrixRow>)r.Get(path.ElementAt(0)); 140 foreach (MatrixRow subRow in subRows) { 137 141 if (subRow.Get(path.ElementAt(1)) != null) { 138 142 xs.Add(matrix.IndexOfCategoricalValue(xDimension, subRow.Get(path.ElementAt(1))) + r.YJitter * xJitterFactor); … … 142 146 } else if (matrix.MultiDimensionalOrdinalVariables.Contains(xDimension)) { 143 147 var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 144 IEnumerable< VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));145 foreach ( VisualMatrixRow subRow in subRows) {148 IEnumerable<MatrixRow> subRows = (IEnumerable<MatrixRow>)r.Get(path.ElementAt(0)); 149 foreach (MatrixRow subRow in subRows) { 146 150 if (subRow.Get(path.ElementAt(1)) != null) { 147 151 xs.Add(Convert.ToDouble(subRow.Get(path.ElementAt(1))) + r.XJitter * xJitterFactor); … … 158 162 } else if (matrix.MultiDimensionalCategoricalVariables.Contains(yDimension)) { 159 163 var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 160 IEnumerable< VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));161 foreach ( VisualMatrixRow subRow in subRows) {164 IEnumerable<MatrixRow> subRows = (IEnumerable<MatrixRow>)r.Get(path.ElementAt(0)); 165 foreach (MatrixRow subRow in subRows) { 162 166 if (subRow.Get(path.ElementAt(1)) != null) { 163 167 ys.Add(matrix.IndexOfCategoricalValue(yDimension, subRow.Get(path.ElementAt(1))) + r.YJitter * yJitterFactor); … … 167 171 } else if (matrix.MultiDimensionalOrdinalVariables.Contains(yDimension)) { 168 172 var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 169 IEnumerable< VisualMatrixRow> subRows = (IEnumerable<VisualMatrixRow>)r.Get(path.ElementAt(0));170 foreach ( VisualMatrixRow subRow in subRows) {173 IEnumerable<MatrixRow> subRows = (IEnumerable<MatrixRow>)r.Get(path.ElementAt(0)); 174 foreach (MatrixRow subRow in subRows) { 171 175 if (subRow.Get(path.ElementAt(1)) != null) { 172 176 ys.Add(Convert.ToDouble(subRow.Get(path.ElementAt(1))) + r.YJitter * yJitterFactor); -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartView.cs
r2289 r2295 19 19 InitializeComponent(); 20 20 bubbleChartControl.Chart = new ModelingBubbleChart(results, 0, 0, 100, 100); 21 xAxisComboBox.Items.AddRange(results.OrdinalVariables );22 xAxisComboBox.Items.AddRange(results.CategoricalVariables );23 xAxisComboBox.Items.AddRange(results.MultiDimensionalCategoricalVariables );24 xAxisComboBox.Items.AddRange(results.MultiDimensionalOrdinalVariables );25 yAxisComboBox.Items.AddRange(results.OrdinalVariables );26 yAxisComboBox.Items.AddRange(results.CategoricalVariables );27 yAxisComboBox.Items.AddRange(results.MultiDimensionalCategoricalVariables );28 yAxisComboBox.Items.AddRange(results.MultiDimensionalOrdinalVariables );21 xAxisComboBox.Items.AddRange(results.OrdinalVariables.ToArray()); 22 xAxisComboBox.Items.AddRange(results.CategoricalVariables.ToArray()); 23 xAxisComboBox.Items.AddRange(results.MultiDimensionalCategoricalVariables.ToArray()); 24 xAxisComboBox.Items.AddRange(results.MultiDimensionalOrdinalVariables.ToArray()); 25 yAxisComboBox.Items.AddRange(results.OrdinalVariables.ToArray()); 26 yAxisComboBox.Items.AddRange(results.CategoricalVariables.ToArray()); 27 yAxisComboBox.Items.AddRange(results.MultiDimensionalCategoricalVariables.ToArray()); 28 yAxisComboBox.Items.AddRange(results.MultiDimensionalOrdinalVariables.ToArray()); 29 29 sizeComboBox.Items.Add(CONSTANT_SIZE); 30 sizeComboBox.Items.AddRange(results.OrdinalVariables );30 sizeComboBox.Items.AddRange(results.OrdinalVariables.ToArray()); 31 31 sizeComboBox.SelectedItem = sizeComboBox.Items[0]; 32 32 yAxisComboBox.SelectedItem = yAxisComboBox.Items[0]; -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/ModelingBubbleChart.cs
r2289 r2295 46 46 47 47 public void matrix_Changed(object sender, EventArgs e) { 48 Repaint(); 49 EnforceUpdate(); 48 Refresh(); 50 49 } 51 50 -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/VisualMatrix.cs
r2289 r2295 11 11 private Matrix matrix; 12 12 13 public VisualMatrix(Matrix matrix, string[] categoricalVariables, string[] ordinalVariables, 14 string[] multiDimensionalCategoricalVariables,string[] multiDimensionalOrdinalVariables) { 13 public VisualMatrix() { 14 this.rows = new List<VisualMatrixRow>(); 15 this.categoricalVariables = new List<string>(); 16 this.ordinalVariables = new List<string>(); 17 this.multiDimensionalCategoricalVariables = new List<string>(); 18 this.multiDimensionalOrdinalVariables = new List<string>(); 19 this.categoricalValueIndices = new Dictionary<string, Dictionary<object, double>>(); } 20 21 public VisualMatrix(Matrix matrix, IEnumerable<string> categoricalVariables, IEnumerable<string> ordinalVariables, 22 IEnumerable<string> multiDimensionalCategoricalVariables, IEnumerable<string> multiDimensionalOrdinalVariables) 23 : this() { 15 24 this.matrix = matrix; 16 this.rows = new List<VisualMatrixRow>(); 17 foreach(MatrixRow row in matrix.GetRows()) 25 this.matrix.Changed += new EventHandler(MatrixChanged); 26 27 foreach (MatrixRow row in matrix.GetRows()) 18 28 rows.Add(new VisualMatrixRow(row)); 19 29 20 this.categoricalVariables = categoricalVariables; 21 this.ordinalVariables = ordinalVariables; 22 this.multiDimensionalOrdinalVariables = multiDimensionalOrdinalVariables; 23 this.multiDimensionalCategoricalVariables = multiDimensionalCategoricalVariables; 24 this.categoricalValueIndices = new Dictionary<string, Dictionary<object, double>>(); 25 26 matrix.Changed += new EventHandler(MatrixChanged); 30 this.categoricalVariables.AddRange(categoricalVariables); 31 this.ordinalVariables.AddRange(ordinalVariables); 32 this.multiDimensionalCategoricalVariables.AddRange(multiDimensionalCategoricalVariables); 33 this.multiDimensionalOrdinalVariables.AddRange(multiDimensionalOrdinalVariables); 27 34 } 28 35 … … 34 41 } 35 42 36 private string[] categoricalVariables; 37 public string[] CategoricalVariables { 43 public void AddRow(VisualMatrixRow row) { 44 this.rows.Add(row); 45 } 46 47 public void RemoveRow(VisualMatrixRow row) { 48 this.rows.Remove(row); 49 } 50 51 public void ClearAllRows(VisualMatrixRow row) { 52 this.rows.Clear(); 53 } 54 55 private List<string> categoricalVariables; 56 public IEnumerable<string> CategoricalVariables { 38 57 get { return categoricalVariables; } 39 58 } 40 59 41 private string[] ordinalVariables; 42 public string[] OrdinalVariables { 60 public void AddCategoricalVariable(string name) { 61 this.categoricalVariables.Add(name); 62 } 63 64 public void RemoveCategoricalVariable(string name) { 65 this.categoricalVariables.Remove(name); 66 } 67 68 public void ClearCategoricalVariables() { 69 this.categoricalVariables.Clear(); 70 } 71 72 private List<string> ordinalVariables; 73 public IEnumerable<string> OrdinalVariables { 43 74 get { return ordinalVariables; } 44 75 } 45 76 46 private string[] multiDimensionalOrdinalVariables; 47 public string[] MultiDimensionalOrdinalVariables { 77 public void AddOrdinalVariable(string name) { 78 this.ordinalVariables.Add(name); 79 } 80 81 public void RemoveOrdinalVariable(string name) { 82 this.ordinalVariables.Remove(name); 83 } 84 85 public void ClearOrdinalVariables() { 86 this.ordinalVariables.Clear(); 87 } 88 89 private List<string> multiDimensionalOrdinalVariables; 90 public IEnumerable<string> MultiDimensionalOrdinalVariables { 48 91 get { return multiDimensionalOrdinalVariables; } 49 92 } 50 93 51 private string[] multiDimensionalCategoricalVariables; 52 public string[] MultiDimensionalCategoricalVariables { 94 public void AddMultiDimensionalOrdinalVariable(string name) { 95 this.multiDimensionalOrdinalVariables.Add(name); 96 } 97 98 public void RemoveMultiDimensionalOrdinalVariable(string name) { 99 this.multiDimensionalOrdinalVariables.Remove(name); 100 } 101 102 public void ClearMultiDimensionalOrdinalVariables() { 103 this.multiDimensionalOrdinalVariables.Clear(); 104 } 105 106 private List<string> multiDimensionalCategoricalVariables; 107 public IEnumerable<string> MultiDimensionalCategoricalVariables { 53 108 get { return multiDimensionalCategoricalVariables; } 54 109 } 55 110 111 public void AddMultiDimensionalCategoricalVariable(string name) { 112 this.multiDimensionalCategoricalVariables.Add(name); 113 } 114 115 public void RemoveMultiDimensionalCategoricalVariable(string name) { 116 this.multiDimensionalCategoricalVariables.Remove(name); 117 } 118 119 public void ClearMultiDimensionalCategoricalVariables() { 120 this.multiDimensionalCategoricalVariables.Clear(); 121 } 122 56 123 public double IndexOfCategoricalValue(string variable, object value) { 57 124 if (value == null) return double.NaN; … … 74 141 } 75 142 76 77 get { return CategoricalVariables.Concat(OrdinalVariables);}143 public IEnumerable<string> Attributes { 144 get { return CategoricalVariables.Concat(OrdinalVariables); } 78 145 } 79 146 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/VisualMatrixRow.cs
r2289 r2295 7 7 8 8 namespace HeuristicLab.CEDMA.Charting { 9 public class VisualMatrixRow { 10 private MatrixRow row; 9 public class VisualMatrixRow : ItemBase { 11 10 private static Random random = new Random(); 11 private Dictionary<string, object> dict; 12 12 13 public VisualMatrixRow( MatrixRow row) {14 this. row = row;13 public VisualMatrixRow() { 14 this.dict = new Dictionary<string, object>(); 15 15 this.visible = true; 16 16 this.selected = false; 17 17 this.xJitter = random.NextDouble() * 2.0 - 1.0; 18 18 this.yJitter = random.NextDouble() * 2.0 - 1.0; 19 } 20 21 public VisualMatrixRow(MatrixRow row) 22 : this() { 23 foreach (KeyValuePair<string, object> value in row.Values) 24 dict[value.Key] = value.Value; 19 25 } 20 26 … … 42 48 43 49 public object Get(string name) { 44 return row.Get(name); 50 if (!dict.ContainsKey(name)) 51 return null; 52 return dict[name]; 53 } 54 55 public void Set(string name, object value) { 56 this.dict[name] = value; 57 } 58 59 public IEnumerable<KeyValuePair<string, object>> Values { 60 get { return dict; } 45 61 } 46 62 … … 51 67 public string GetToolTipText() { 52 68 StringBuilder b = new StringBuilder(); 53 foreach (KeyValuePair<string, object> v in row.Values) {69 foreach (KeyValuePair<string, object> v in dict) { 54 70 if (v.Value is string || v.Value is double || v.Value is int) { 55 71 string val = v.Value.ToString(); -
trunk/sources/HeuristicLab.CEDMA.Core/3.3/Console.cs
r2289 r2295 94 94 row.Set("TargetVariable", model.TargetVariable.Name); 95 95 row.Set("Algorithm", model.Algorithm.Name); 96 Dictionary<HeuristicLab.Modeling.Database.IVariable, MatrixRow> inputVariableResultsEntries = 97 new Dictionary<HeuristicLab.Modeling.Database.IVariable, MatrixRow>(); 98 99 foreach (IInputVariableResult inputVariableResult in db.GetInputVariableResults(model)) { 100 if (!inputVariableResultsEntries.ContainsKey(inputVariableResult.Variable)) { 101 inputVariableResultsEntries[inputVariableResult.Variable] = new MatrixRow(); 102 inputVariableResultsEntries[inputVariableResult.Variable].Set("InputVariableName", inputVariableResult.Variable.Name); 103 } 104 inputVariableResultsEntries[inputVariableResult.Variable].Set(inputVariableResult.Result.Name, inputVariableResult.Value); 105 } 106 row.Set("VariableImpacts", inputVariableResultsEntries.Values); 96 107 97 matrix.AddRow(row); 108 98 } … … 113 103 DatabaseService db = new DatabaseService(sqlServerCompactConnectionString + database); 114 104 db.Connect(); 115 string[] multiDimensionalCategoricalVariables = new string[]{ "VariableImpacts: InputVariableName" };116 string[] multiDimensionalOrdinalVariables = db.GetAllResultsForInputVariables().Select(x => "VariableImpacts: " + x.Name).ToArray();117 string[] ordinalVariables = db.GetAllResults().Select(r => r.Name).ToArray();118 string[] categoricalVariables = new string[]{ "TargetVariable", "Algorithm" };105 IEnumerable<string> multiDimensionalCategoricalVariables = new List<string> { "VariableImpacts: InputVariableName" }; 106 IEnumerable<string> multiDimensionalOrdinalVariables = db.GetAllResultsForInputVariables().Select(x => "VariableImpacts: " + x.Name); 107 IEnumerable<string> ordinalVariables = db.GetAllResults().Select(r => r.Name); 108 IEnumerable<string> categoricalVariables = new List<string> { "TargetVariable", "Algorithm" }; 119 109 120 110 db.Disconnect();
Note: See TracChangeset
for help on using the changeset viewer.