private static double evalLikelihoodUnweighted()

in src/main/java/com/twitter/sbf/core/MHAlgorithm.java [1190:1204]


  private static double evalLikelihoodUnweighted(Graph graph, SparseBinaryMatrix matrix, int myId,
                                                 int[] factor, double weightCoeff) {
    int numTruePositive = 0;
    for (int neighborId : graph.getNeighbors(myId)) {
      if (Util.hasCommonElement(factor, matrix.getRow(neighborId))) {
        numTruePositive++;
      }
    }
    int numPositive = matrix.nnzInColumnSum(factor);
    int numNegative = graph.getNumVertices() - numPositive;
    int numFalseNegative = graph.getDegree(myId) - numTruePositive;
    int selfNegative = matrix.getRow(myId).length == 0 ? 1 : 0;
    int numTrueNegative = numNegative - numFalseNegative - selfNegative;
    return weightCoeff * numTruePositive + numTrueNegative;
  }