public double outFlow(Object node) { Set<Arc> arcs = getArcsBySource(node); return sumOutputs(arcs); }
private double getSourceTotal(Object node) { double result = 0.0; Set<Arc> arcs = getArcsBySource(node); if (arcs.isEmpty()) { log.info("No outbound arcs from node."); return result; } for (Arc arc : arcs) { result += ((Double) arc.getOutput()).doubleValue(); } return result; }
/** * for testing only. doubles combined by addition. */ public List sampleUniformPathFromGraph() { List list = new ArrayList(); Object node = this.getStartNode(); Set endNodes = this.getEndNodes(); while (!endNodes.contains(node)) { List<Arc> arcs = new ArrayList<>(this.getArcsBySource(node)); TransducerGraph.Arc arc = arcs.get(r.nextInt(arcs.size())); list.add(arc.getInput()); node = arc.getTargetNode(); } return list; }
result.append("height=\"0.3\", width=\"0.3\""); result.append(" ];\n"); for (Arc arc : getArcsBySource(node)) { result.append(StringUtils.fileNameClean(arc.getSourceNode().toString())); result.append(" -> ");
public TransducerGraph processGraph(TransducerGraph g) { g = new TransducerGraph(g); Set nodes = g.getNodes(); for (Object node : nodes) { Set<Arc> myArcs = null; if (forward) { myArcs = g.getArcsBySource(node); } else { myArcs = g.getArcsByTarget(node); } // compute a total double total = 0.0; for (Arc a : myArcs) { total += ((Double) a.getOutput()).doubleValue(); } // divide each by total for (Arc a : myArcs) { a.setOutput(new Double(Math.log(((Double) a.getOutput()).doubleValue() / total))); } } return g; } }
Set<Arc> arcs; if (forward) { arcs = this.getArcsBySource(node); } else { arcs = this.getArcsByTarget(node);
if (startLambda != 0.0) { Set<TransducerGraph.Arc> startArcs = result.getArcsBySource(result.getStartNode()); for (TransducerGraph.Arc arc : startArcs) { double oldOutput = ((Double) arc.getOutput()).doubleValue();
private double getSourceTotal(Object node) { double result = 0.0; Set<Arc> arcs = getArcsBySource(node); if (arcs.isEmpty()) { System.err.println("No outbound arcs from node."); return result; } for (Arc arc : arcs) { result += ((Double) arc.getOutput()).doubleValue(); } return result; }
public double outFlow(Object node) { Set<Arc> arcs = getArcsBySource(node); return sumOutputs(arcs); }
public double getSourceTotal(Object node) { double result = 0.0; Set<Arc> arcs = getArcsBySource(node); if (arcs.size() == 0) { System.err.println("No outbound arcs from node."); return result; } for (Arc arc : arcs) { result += ((Double) arc.getOutput()).doubleValue(); } return result; }
public double outFlow(Object node) { Set<Arc> arcs = getArcsBySource(node); return sumOutputs(arcs); }
public double outFlow(Object node) { Set<Arc> arcs = getArcsBySource(node); return sumOutputs(arcs); }
public double outFlow(Object node) { Set<Arc> arcs = getArcsBySource(node); return sumOutputs(arcs); }
private double getSourceTotal(Object node) { double result = 0.0; Set<Arc> arcs = getArcsBySource(node); if (arcs.isEmpty()) { log.info("No outbound arcs from node."); return result; } for (Arc arc : arcs) { result += ((Double) arc.getOutput()).doubleValue(); } return result; }
private double getSourceTotal(Object node) { double result = 0.0; Set<Arc> arcs = getArcsBySource(node); if (arcs.isEmpty()) { log.info("No outbound arcs from node."); return result; } for (Arc arc : arcs) { result += ((Double) arc.getOutput()).doubleValue(); } return result; }
/** * for testing only. doubles combined by addition. */ public List sampleUniformPathFromGraph() { List list = new ArrayList(); Object node = this.getStartNode(); Set endNodes = this.getEndNodes(); while (!endNodes.contains(node)) { List<Arc> arcs = new ArrayList<Arc>(this.getArcsBySource(node)); TransducerGraph.Arc arc = arcs.get(r.nextInt(arcs.size())); list.add(arc.getInput()); node = arc.getTargetNode(); } return list; }
/** * for testing only. doubles combined by addition. */ public List sampleUniformPathFromGraph() { List list = new ArrayList(); Object node = this.getStartNode(); Set endNodes = this.getEndNodes(); while (!endNodes.contains(node)) { List<Arc> arcs = new ArrayList<>(this.getArcsBySource(node)); TransducerGraph.Arc arc = arcs.get(r.nextInt(arcs.size())); list.add(arc.getInput()); node = arc.getTargetNode(); } return list; }
/** * for testing only. doubles combined by addition. */ public List sampleUniformPathFromGraph() { List list = new ArrayList(); Object node = this.getStartNode(); Set endNodes = this.getEndNodes(); while (!endNodes.contains(node)) { List<Arc> arcs = new ArrayList<>(this.getArcsBySource(node)); TransducerGraph.Arc arc = arcs.get(r.nextInt(arcs.size())); list.add(arc.getInput()); node = arc.getTargetNode(); } return list; }
/** * for testing only. doubles combined by addition. */ public List sampleUniformPathFromGraph() { List list = new ArrayList(); Object node = this.getStartNode(); Set endNodes = this.getEndNodes(); while (!endNodes.contains(node)) { List<Arc> arcs = new ArrayList<Arc>(this.getArcsBySource(node)); TransducerGraph.Arc arc = arcs.get(r.nextInt(arcs.size())); list.add(arc.getInput()); node = arc.getTargetNode(); } return list; }
public TransducerGraph processGraph(TransducerGraph g) { g = new TransducerGraph(g); Set nodes = g.getNodes(); for (Object node : nodes) { Set<Arc> myArcs = null; if (forward) { myArcs = g.getArcsBySource(node); } else { myArcs = g.getArcsByTarget(node); } // compute a total double total = 0.0; for (Arc a : myArcs) { total += ((Double) a.getOutput()).doubleValue(); } // divide each by total for (Arc a : myArcs) { a.setOutput(new Double(Math.log(((Double) a.getOutput()).doubleValue() / total))); } } return g; } }