Search in sources :

Example 1 with AbstractVertexFactory

use of org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory in project deeplearning4j by deeplearning4j.

the class GraphTransformerTest method setUp.

@Before
public void setUp() throws Exception {
    if (graph == null) {
        graph = new Graph<>(10, false, new AbstractVertexFactory<VocabWord>());
        for (int i = 0; i < 10; i++) {
            graph.getVertex(i).setValue(new VocabWord(i, String.valueOf(i)));
            int x = i + 3;
            if (x >= 10)
                x = 0;
            graph.addEdge(i, x, 1.0, false);
        }
    }
}
Also used : AbstractVertexFactory(org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory) VocabWord(org.deeplearning4j.models.word2vec.VocabWord) Before(org.junit.Before)

Example 2 with AbstractVertexFactory

use of org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory in project deeplearning4j by deeplearning4j.

the class RandomWalkerTest method setUp.

@Before
public void setUp() throws Exception {
    if (graph == null) {
        graph = new Graph<>(10, false, new AbstractVertexFactory<VocabWord>());
        for (int i = 0; i < 10; i++) {
            graph.getVertex(i).setValue(new VocabWord(i, String.valueOf(i)));
            int x = i + 3;
            if (x >= 10)
                x = 0;
            graph.addEdge(i, x, 1.0, false);
        }
        graphDirected = new Graph<>(10, false, new AbstractVertexFactory<VocabWord>());
        for (int i = 0; i < 10; i++) {
            graphDirected.getVertex(i).setValue(new VocabWord(i, String.valueOf(i)));
            int x = i + 3;
            if (x >= 10)
                x = 0;
            graphDirected.addEdge(i, x, 1.0, true);
        }
        graphBig = new Graph<>(1000, false, new AbstractVertexFactory<VocabWord>());
        for (int i = 0; i < 1000; i++) {
            graphBig.getVertex(i).setValue(new VocabWord(i, String.valueOf(i)));
            int x = i + 3;
            if (x >= 1000)
                x = 0;
            graphBig.addEdge(i, x, 1.0, false);
        }
    }
}
Also used : AbstractVertexFactory(org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory) VocabWord(org.deeplearning4j.models.word2vec.VocabWord) Before(org.junit.Before)

Example 3 with AbstractVertexFactory

use of org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory in project deeplearning4j by deeplearning4j.

the class PopularityWalkerTest method setUp.

@Before
public void setUp() {
    if (graph == null) {
        graph = new Graph<>(10, false, new AbstractVertexFactory<VocabWord>());
        for (int i = 0; i < 10; i++) {
            graph.getVertex(i).setValue(new VocabWord(i, String.valueOf(i)));
            int x = i + 3;
            if (x >= 10)
                x = 0;
            graph.addEdge(i, x, 1.0, false);
        }
        graph.addEdge(0, 4, 1.0, false);
        graph.addEdge(0, 4, 1.0, false);
        graph.addEdge(0, 4, 1.0, false);
        graph.addEdge(4, 5, 1.0, false);
        graph.addEdge(1, 3, 1.0, false);
        graph.addEdge(9, 7, 1.0, false);
        graph.addEdge(5, 6, 1.0, false);
    }
}
Also used : AbstractVertexFactory(org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory) VocabWord(org.deeplearning4j.models.word2vec.VocabWord) Before(org.junit.Before)

Example 4 with AbstractVertexFactory

use of org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory in project deeplearning4j by deeplearning4j.

the class WeightedWalkerTest method setUp.

@Before
public void setUp() throws Exception {
    if (basicGraph == null) {
        // we don't really care about this graph, since it's just basic graph for iteration checks
        basicGraph = new Graph<>(10, false, new AbstractVertexFactory<VocabWord>());
        for (int i = 0; i < 10; i++) {
            basicGraph.getVertex(i).setValue(new VocabWord(i, String.valueOf(i)));
            int x = i + 3;
            if (x >= 10)
                x = 0;
            basicGraph.addEdge(i, x, 1, false);
        }
        basicGraph.addEdge(0, 4, 2, false);
        basicGraph.addEdge(0, 4, 4, false);
        basicGraph.addEdge(0, 4, 6, false);
        basicGraph.addEdge(4, 5, 8, false);
        basicGraph.addEdge(1, 3, 6, false);
        basicGraph.addEdge(9, 7, 4, false);
        basicGraph.addEdge(5, 6, 2, false);
    }
}
Also used : AbstractVertexFactory(org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory) VocabWord(org.deeplearning4j.models.word2vec.VocabWord) Before(org.junit.Before)

Aggregations

AbstractVertexFactory (org.deeplearning4j.models.sequencevectors.graph.vertex.AbstractVertexFactory)4 VocabWord (org.deeplearning4j.models.word2vec.VocabWord)4 Before (org.junit.Before)4