edu.cmu.tetrad.algcomparison.statistic.DensityEst Maven / Gradle / Ivy
The newest version!
package edu.cmu.tetrad.algcomparison.statistic;
import edu.cmu.tetrad.data.DataModel;
import edu.cmu.tetrad.graph.Graph;
import java.io.Serial;
/**
* The adjacency precision. The true positives are the number of adjacencies in both the true and estimated graphs.
*
* @author josephramsey
* @version $Id: $Id
*/
public class DensityEst implements Statistic {
@Serial
private static final long serialVersionUID = 23L;
/**
* Initializes a new instance of the DensityEst class.
*/
public DensityEst() {
}
/**
* {@inheritDoc}
*/
@Override
public String getAbbreviation() {
return "DensEst";
}
/**
* {@inheritDoc}
*/
@Override
public String getDescription() {
return "Density of Estimated Graph";
}
/**
* {@inheritDoc}
*/
@Override
public double getValue(Graph trueGraph, Graph estGraph, DataModel dataModel) {
return new AverageDegreeEst().getValue(trueGraph, estGraph, dataModel)
/ (double) (estGraph.getNumNodes() - 1);
}
/**
* {@inheritDoc}
*/
@Override
public double getNormValue(double value) {
return value;
}
}