public double calculateProb(int first, int second) {
        //Get vector for first vertex, as well as code for second:
        INDArray vec = vertexVectors.getRow(first);
        int codeLength = tree.getCodeLength(second);
        long code = tree.getCode(second);
        int[] innerNodesForVertex = tree.getPathInnerNodes(second);

        double prob = 1.0;
        for (int i = 0; i < codeLength; i++) {
            boolean path = getBit(code, i); //left or right?
            //Inner node:
            int innerNodeIdx = innerNodesForVertex[i];
            INDArray nwi = outWeights.getRow(innerNodeIdx);

            double dot = Nd4j.getBlasWrapper().dot(nwi, vec);

            //double sigmoidDot = sigmoid(dot);
            double innerProb = (path ? sigmoid(dot) : sigmoid(-dot)); //prob of going left or right at inner node
            prob *= innerProb;
        }
        return prob;
    }
public double calculateProb ( int first , int second ) { INDArray vec = vertexVectors . getRow ( first ) ; int codeLength = tree . getCodeLength ( second ) ; long code = tree . getCode ( second ) ; int [ ] innerNodesForVertex = tree . getPathInnerNodes ( second ) ; double prob = 1.0 ; for ( int i = 0 ; i < codeLength ; i ++ ) { boolean path = getBit ( code , i ) ; int innerNodeIdx = innerNodesForVertex [ i ] ; INDArray nwi = outWeights . getRow ( innerNodeIdx ) ; double dot = Nd4j . getBlasWrapper ( ) . dot ( nwi , vec ) ; double innerProb = ( path ? sigmoid ( dot ) : sigmoid ( - dot ) ) ; prob *= innerProb ; } return prob ; }
Calculate the probability of the second vertex given the first vertex
i.e., P(v_second | v_first)
@param first index of the first vertex
@param second index of the second vertex
@return probability, P(v_second | v_first)