Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/17/17 13:13:04 (7 years ago)
Author:
bburlacu
Message:

#2288: Sync with trunk + Minor refactor.

Location:
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs

    r14275 r15421  
    2626using System.Linq;
    2727using System.Windows.Forms;
    28 using HeuristicLab.Common;
    2928using HeuristicLab.Core;
    3029using HeuristicLab.Random;
     
    158157        shape.Move(new Offset(pos.X, pos.Y));
    159158      }
    160       var colors = ColorGradient.GrayscaledColors;
     159
    161160      foreach (var pair in arcRoutes) {
    162161        var arc = pair.Key;
     
    167166        Pen pen;
    168167        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;
    173169        if (len == 2) {
    174170          if (double.IsInfinity(penWidth) || double.IsNaN(penWidth))
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs

    r14275 r15421  
    107107      var dataset = (Dataset)solution.ProblemData.Dataset;
    108108      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());
    115110
    116111      var targetImpacts = new Dictionary<string, Tuple<IEnumerable<IRun>, Dictionary<string, double>>>();
     
    135130              estimationLimits = (DoubleLimit)run.Parameters["EstimationLimits"];
    136131            }
     132            var md = dataset.ToModifiable();
    137133            var impacts = CalculateImpacts(sol, md, originalValues, medians, estimationLimits);
    138             //            var impacts = RegressionSolutionVariableImpactsCalculator.CalculateImpacts(sol).ToDictionary(x => x.Item1, x => x.Item2);
    139134            foreach (var pair in impacts) {
    140135              if (averageImpacts.ContainsKey(pair.Key))
     
    190185      var targets = runs.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
    191186      var targetImpacts = new Dictionary<string, Tuple<IEnumerable<IRun>, Dictionary<string, double>>>();
     187
     188      Func<IRun, double> getQualityValue = run => ((DoubleValue)run.Results[qualityResultName]).Value;
     189
    192190      if (useBestRunsPerTarget) {
    193191        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());
    196194
    197195        foreach (var run in bestRunsPerTarget) {
     
    266264            }
    267265            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)
    269268            };
    270269            vn.AddArc(arc);
Note: See TracChangeset for help on using the changeset viewer.