Search in sources :

Example 1 with RWOutlink

use of edu.cmu.ml.proppr.graph.RWOutlink in project ProPPR by TeamCohen.

the class SRWRestartTest method moreOutlinks.

@Override
public void moreOutlinks(LearningGraphBuilder lgb, LearningGraph graph, int u) {
    ArrayLearningGraphBuilder b = ((ArrayLearningGraphBuilder) lgb);
    // first see if we already have a reset link (covered by makeOutlink())
    int r0 = nodes.getId("r0");
    if (b.outlinks[u] != null) {
        for (RWOutlink o : b.outlinks[u]) {
            if (o.nodeid == r0) {
                return;
            }
        }
    }
    // no reset link exists, so add one
    lgb.addOutlink(graph, u, new RWOutlink(new int[] { lgb.getFeatureLibrary().getId("id(restart)") }, new double[] { this.srw.getSquashingFunction().defaultValue() }, r0));
}
Also used : RWOutlink(edu.cmu.ml.proppr.graph.RWOutlink) ArrayLearningGraphBuilder(edu.cmu.ml.proppr.graph.ArrayLearningGraphBuilder)

Aggregations

ArrayLearningGraphBuilder (edu.cmu.ml.proppr.graph.ArrayLearningGraphBuilder)1 RWOutlink (edu.cmu.ml.proppr.graph.RWOutlink)1