edu.cmu.tetrad.algcomparison.statistic.FalsePositiveAdjacencies Maven / Gradle / Ivy
package edu.cmu.tetrad.algcomparison.statistic;
import edu.cmu.tetrad.data.DataModel;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.graph.Node;
import java.util.List;
/**
* The bidirected true positives.
*
* @author josephramsey
*/
public class FalsePositiveAdjacencies implements Statistic {
private static final long serialVersionUID = 23L;
@Override
public String getAbbreviation() {
return "FP-Adj";
}
@Override
public String getDescription() {
return "False Positives Adjacencies";
}
@Override
public double getValue(Graph trueGraph, Graph estGraph, DataModel dataModel) {
int fp = 0;
List nodes = trueGraph.getNodes();
for (int i = 0; i < nodes.size(); i++) {
for (int j = i + 1; j < nodes.size(); j++) {
Node x = nodes.get(i);
Node y = nodes.get(j);
if (estGraph.isAdjacentTo(x, y)) {
if (!trueGraph.isAdjacentTo(x, y)) {
fp++;
}
}
}
}
return fp;
}
@Override
public double getNormValue(double value) {
return value;
}
}