All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.cmu.tetrad.algcomparison.statistic.FalseNegativesAdjacencies Maven / Gradle / Ivy

There is a newer version: 7.6.4
Show newest version
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 FalseNegativesAdjacencies implements Statistic {
    private static final long serialVersionUID = 23L;

    @Override
    public String getAbbreviation() {
        return "FN-Adj";
    }

    @Override
    public String getDescription() {
        return "False Negatives Adjacencies";
    }

    @Override
    public double getValue(Graph trueGraph, Graph estGraph, DataModel dataModel) {
        int fn = 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 (trueGraph.isAdjacentTo(x, y)) {
                    if (!estGraph.isAdjacentTo(x, y)) {
                        fn++;
                    }
                }
            }
        }

        return fn;
    }

    @Override
    public double getNormValue(double value) {
        return value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy