Package edu.cmu.graphchi.preprocessing

Examples of edu.cmu.graphchi.preprocessing.VertexIdTranslate.forward()


        /* For debug */
        VertexIdTranslate vertexIdTranslate = this.drunkardMobEngine.getVertexIdTranslate();
        IdCount[] topForFirst = companion.getTop(firstSource, 10);

        System.out.println("Top visits from source vertex " + vertexIdTranslate.forward(firstSource) + " (internal id=" + firstSource + ")");
        for(IdCount idc : topForFirst) {
            System.out.println(vertexIdTranslate.backward(idc.id) + ": " + idc.count);
        }

        /* If local, shutdown the companion */
 
View Full Code Here


        BufferedWriter wr = new BufferedWriter(new FileWriter(leftFileName));
        wr.write("%%MatrixMarket matrix array real general\n");
        wr.write(this.D + " " + numLeft + "\n");

        for(int j=0; j < numLeft; j++) {
            int vertexId = vertexIdTranslate.forward(j)// Translate to internal vertex id
            for(int i=0; i < D; i++) {
                wr.write(vertexValueMatrix.getValue(vertexId, i) + "\n");
            }
        }
        wr.close();
View Full Code Here

        wr = new BufferedWriter(new FileWriter(rightFileName));
        wr.write("%%MatrixMarket matrix array real general\n");
        wr.write(this.D + " " + numRight + "\n");

        for(int j=0; j < numRight; j++) {
            int vertexId = vertexIdTranslate.forward(numLeft + j);   // Translate to internal vertex id
            for(int i=0; i < D; i++) {
                wr.write(vertexValueMatrix.getValue(vertexId, i) + "\n");
            }
        }
        wr.close();
View Full Code Here

        if (numUsers > graphInfo.getNumLeft())  graphInfo.getNumLeft();
        logger.info("Compute predictions for first " + numUsers + " users");

        for(int i=0; i< numUsers; i++) {
            userVertices.add(vertexIdTranslate.forward(i));
        }

        /* Configure */
        positiveJob.configureWalkSources(userVertices, walksPerSource);
        negativeJob.configureWalkSources(userVertices, walksPerSource);
View Full Code Here

        drunkardMobEngine.run(6);


        /* TODO: handle results */
        for(int i=0; i< 500; i++) {
            int userId = vertexIdTranslate.forward(i);
            IdCount[] posTop = positiveJob.getCompanion().getTop(userId, 20);
            IdCount[] negTop =  negativeJob.getCompanion().getTop(userId, 20);

            double sumEstimatePos = 0.0;
            double sumEstimateNeg = 0.0;
View Full Code Here

            long t = System.currentTimeMillis();
            // Compute all
            double allSum = 0;
            int numMovies = graphInfo.getNumRight();
            for(int m=0; m < numMovies; m++) {
                int movieId = vertexIdTranslate.forward(graphInfo.getNumLeft() + m);
                allSum += als.predict(userId, movieId);
            }

            System.out.println(i + " avg pos: " + sumEstimatePos / n + "; avg neg: " + sumEstimateNeg / n + "; all="
                    + allSum / graphInfo.getNumRight() + " (" + (System.currentTimeMillis() - t) + " ms for " + numMovies + " movies");
View Full Code Here

            System.out.print("Enter vertex id to query >> :: ");
            String ln = cmdIn.readLine();
            int vertex = Integer.parseInt(ln);

            // Circle of trust is just the vertex's followers for now
            HashSet<Integer> circle = csalsa.queryService.queryOutNeighbors(vertexTrans.forward(vertex));

            int maxCircleSize = 300;
            // max 500
            if (circle.size() > maxCircleSize) {
                int[] all = new int[circle.size()];
View Full Code Here

            long t = System.currentTimeMillis();
            csalsa.computeSALSA(3);
            logger.info("SALSA computation took " + (System.currentTimeMillis() - t) + "ms");

            circle.add(vertexTrans.forward(vertex));
            ArrayList<SalsaVertex> top = csalsa.topAuthorities(20, circle);
            int j = 1;
            for(SalsaVertex sv : top) {
                int originalId = vertexTrans.backward(sv.id);
                logger.info("Top " + (j++) + " = " + originalId + " " + csalsa.namify(originalId) + " (" + sv.value + ")");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.