Search in sources :

Example 6 with AMatrix

use of mikera.matrixx.AMatrix in project PhenomeScape by soulj.

the class TransitionMatrix method pageRank.

public double[] pageRank(double alpha) {
    AVector probAlpha = prob.copy();
    double eps = 0.000001;
    int iter = 0;
    AVector pi0 = Vector.of(new double[prob.length()]);
    AVector pi1 = prob.copy();
    probAlpha.multiply(alpha);
    AMatrix transitionMatrixT = transitionMatrix.getTranspose();
    while ((distance(pi0, pi1) > eps) && iter < 100000) {
        pi0 = pi1.copy();
        pi1.multiply((1 - alpha));
        pi1 = pi1.innerProduct(transitionMatrixT);
        pi1.add(probAlpha);
        iter++;
    }
    return (pi1.asDoubleArray());
}
Also used : AMatrix(mikera.matrixx.AMatrix) AVector(mikera.vectorz.AVector)

Aggregations

AMatrix (mikera.matrixx.AMatrix)6 AVector (mikera.vectorz.AVector)6 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Index (mikera.indexz.Index)1 SparseRowMatrix (mikera.matrixx.impl.SparseRowMatrix)1 CyApplicationManager (org.cytoscape.application.CyApplicationManager)1 CyEventHelper (org.cytoscape.event.CyEventHelper)1 CyEdge (org.cytoscape.model.CyEdge)1 CyNetworkManager (org.cytoscape.model.CyNetworkManager)1 CyNode (org.cytoscape.model.CyNode)1 CySubNetwork (org.cytoscape.model.subnetwork.CySubNetwork)1 DescendingScoreComparator (org.cytoscape.phenomescape.internal.Protein.DescendingScoreComparator)1 ConnectedComponentAnalyser (org.cytoscape.phenomescape.internal.util.ConnectedComponentAnalyser)1 GOTermAnalyser2 (org.cytoscape.phenomescape.internal.util.GOTermAnalyser2)1 Phenotype (org.cytoscape.phenomescape.internal.util.Phenotype)1 VizStyle (org.cytoscape.phenomescape.internal.util.VizStyle)1 CyLayoutAlgorithm (org.cytoscape.view.layout.CyLayoutAlgorithm)1 CyLayoutAlgorithmManager (org.cytoscape.view.layout.CyLayoutAlgorithmManager)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1