Changeset 13789 for branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs
- Timestamp:
- 04/24/16 20:37:12 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs
r13773 r13789 233 233 IVertex junctionNode; 234 234 if (!nodes.TryGetValue(junctionLabel, out junctionNode)) { 235 junctionNode = new JunctionNetworkNode { Label = string.Empty, Data = CreateEnsembleSolution(targetRuns) }; 235 var solutionsEnsemble = CreateEnsembleSolution(targetRuns); 236 junctionNode = new JunctionNetworkNode { Label = string.Empty, Data = solutionsEnsemble }; 236 237 vn.AddVertex(junctionNode); 237 238 nodes[junctionLabel] = junctionNode; 239 junctionNode.Label = string.Format("Target quality: {0:0.000}", solutionsEnsemble.TrainingRSquared); 238 240 } 239 241 IArc arc; … … 245 247 nodes[v] = variableNode; 246 248 } 247 arc = new Arc(variableNode, junctionNode) { Weight = impact };249 arc = new Arc(variableNode, junctionNode) { Weight = impact, Label = string.Format("Impact: {0:0.000}", impact) }; 248 250 vn.AddArc(arc); 249 251 } 250 arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight) }; 252 var trainingR2 = ((IRegressionSolution)((JunctionNetworkNode)junctionNode).Data).TrainingRSquared; 253 arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight), Label = string.Format("Quality: {0:0.000}", trainingR2) }; 251 254 vn.AddArc(arc); 252 255 } else { … … 258 261 nodes[v] = variableNode; 259 262 } 260 var arc = new Arc(variableNode, targetNode) { Weight = impact };263 var arc = new Arc(variableNode, targetNode) { Weight = impact, Label = string.Format("Impact: {0:0.000}", impact) }; 261 264 vn.AddArc(arc); 262 265 } … … 380 383 var filteredNetwork = new VariableInteractionNetwork(); 381 384 var cloner = new Cloner(); 382 var vertices = arcs.SelectMany(x => new[] { x.Source, x.Target }).Select(cloner.Clone) ; // arcs are not cloned385 var vertices = arcs.SelectMany(x => new[] { x.Source, x.Target }).Select(cloner.Clone).Distinct(); // arcs are not cloned 383 386 filteredNetwork.AddVertices(vertices); 384 foreach (var arc in arcs) { 385 var source = cloner.Clone(arc.Source); 386 var target = cloner.Clone(arc.Target); 387 filteredNetwork.AddArc(source, target); 388 } 387 filteredNetwork.AddArcs(arcs.Select(x => (IArc)x.Clone(cloner))); 388 389 389 var unusedJunctions = filteredNetwork.Vertices.Where(x => x.InDegree == 0 && x is JunctionNetworkNode).ToList(); 390 390 filteredNetwork.RemoveVertices(unusedJunctions); … … 443 443 button.Enabled = false; 444 444 var impacts = CalculateVariableImpactsOnline(Content, false); 445 var network = CreateNetwork(impacts);445 variableInteractionNetwork = CreateNetwork(impacts); 446 446 var threshold = double.Parse(impactThresholdTextBox.Text); 447 graphChart.Graph = ApplyThreshold( network, threshold);447 graphChart.Graph = ApplyThreshold(variableInteractionNetwork, threshold); 448 448 }; 449 449 worker.RunWorkerCompleted += (o, e) => button.Enabled = true;
Note: See TracChangeset
for help on using the changeset viewer.