Changeset 15421
- Timestamp:
- 10/17/17 13:13:04 (7 years ago)
- Location:
- branches/HeuristicLab.VariableInteractionNetworks
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs
r14275 r15421 26 26 using System.Linq; 27 27 using System.Windows.Forms; 28 using HeuristicLab.Common;29 28 using HeuristicLab.Core; 30 29 using HeuristicLab.Random; … … 158 157 shape.Move(new Offset(pos.X, pos.Y)); 159 158 } 160 var colors = ColorGradient.GrayscaledColors; 159 161 160 foreach (var pair in arcRoutes) { 162 161 var arc = pair.Key; … … 167 166 Pen pen; 168 167 var penWidth = weight / max * 3; 169 var colorIndex = (int)Math.Min(255, weight / max * 255); 170 if (colorIndex < 0) colorIndex = 0; 171 if (colorIndex > 255) colorIndex = 255; 172 var penColor = colors[colorIndex]; 168 var penColor = Color.Black; 173 169 if (len == 2) { 174 170 if (double.IsInfinity(penWidth) || double.IsNaN(penWidth)) -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs
r14275 r15421 107 107 var dataset = (Dataset)solution.ProblemData.Dataset; 108 108 var originalValues = dataset.DoubleVariables.ToDictionary(x => x, x => dataset.GetReadOnlyDoubleValues(x).ToList()); 109 var md = dataset.ToModifiable(); 110 var medians = new Dictionary<string, List<double>>(); 111 foreach (var v in dataset.DoubleVariables) { 112 var median = dataset.GetDoubleValues(v, solution.ProblemData.TrainingIndices).Median(); 113 medians[v] = Enumerable.Repeat(median, originalValues[v].Count).ToList(); 114 } 109 var medians = dataset.DoubleVariables.ToDictionary(x => x, x => Enumerable.Repeat(originalValues[x].Median(), originalValues[x].Count).ToList()); 115 110 116 111 var targetImpacts = new Dictionary<string, Tuple<IEnumerable<IRun>, Dictionary<string, double>>>(); … … 135 130 estimationLimits = (DoubleLimit)run.Parameters["EstimationLimits"]; 136 131 } 132 var md = dataset.ToModifiable(); 137 133 var impacts = CalculateImpacts(sol, md, originalValues, medians, estimationLimits); 138 // var impacts = RegressionSolutionVariableImpactsCalculator.CalculateImpacts(sol).ToDictionary(x => x.Item1, x => x.Item2);139 134 foreach (var pair in impacts) { 140 135 if (averageImpacts.ContainsKey(pair.Key)) … … 190 185 var targets = runs.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList(); 191 186 var targetImpacts = new Dictionary<string, Tuple<IEnumerable<IRun>, Dictionary<string, double>>>(); 187 188 Func<IRun, double> getQualityValue = run => ((DoubleValue)run.Results[qualityResultName]).Value; 189 192 190 if (useBestRunsPerTarget) { 193 191 var bestRunsPerTarget = maximization 194 ? targets.Select(x => x.OrderBy( y => ((DoubleValue)y.Results[qualityResultName]).Value).Last())195 : targets.Select(x => x.OrderBy( y => ((DoubleValue)y.Results[qualityResultName]).Value).First());192 ? targets.Select(x => x.OrderBy(getQualityValue).Last()) 193 : targets.Select(x => x.OrderBy(getQualityValue).First()); 196 194 197 195 foreach (var run in bestRunsPerTarget) { … … 266 264 } 267 265 var arc = new Arc(variableNode, targetNode) { 268 Weight = impact, Label = impact.ToString("N3", CultureInfo.CurrentCulture) 266 Weight = impact, 267 Label = impact.ToString("N3", CultureInfo.CurrentCulture) 269 268 }; 270 269 vn.AddArc(arc); -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/SymbolicDataAnalysisVariableImpactsAnalyzer.cs
r13868 r15421 58 58 #endregion 59 59 60 private SymbolicDataAnalysisExpressionTreeSimplifier simplifier;61 60 private SymbolicRegressionSolutionImpactValuesCalculator impactsCalculator; 62 61 … … 136 135 137 136 impactsCalculator = new SymbolicRegressionSolutionImpactValuesCalculator(); 138 simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();139 137 } 140 138 … … 145 143 private void AfterDeserialization() { 146 144 impactsCalculator = new SymbolicRegressionSolutionImpactValuesCalculator(); 147 simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();148 145 149 146 if (!Parameters.ContainsKey(EvaluatorParameterName)) … … 154 151 : base(original, cloner) { 155 152 impactsCalculator = new SymbolicRegressionSolutionImpactValuesCalculator(); 156 simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();157 153 } 158 154 … … 210 206 var bestTrees = trees.Take(nTrees).Select(x => (ISymbolicExpressionTree)x.Clone()).ToList(); 211 207 // simplify trees before doing anything else 212 var simplifiedTrees = bestTrees.Select(x => simplifier.Simplify(x)).ToList();208 var simplifiedTrees = bestTrees.Select(x => TreeSimplifier.Simplify(x)).ToList(); 213 209 214 210 if (optimizeConstants) {
Note: See TracChangeset
for help on using the changeset viewer.