Class StructuralHammingDistance

java.lang.Object
edu.cmu.tetrad.algcomparison.statistic.StructuralHammingDistance
All Implemented Interfaces:
Statistic, Serializable

public class StructuralHammingDistance extends Object implements Statistic
Calculates the structural Hamming distance (SHD) between the estimated graph and the true graph.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • StructuralHammingDistance

      public StructuralHammingDistance()
      Constructs the statistic.
    • StructuralHammingDistance

      public StructuralHammingDistance(boolean compareToCpdag)
      Constructs a StructuralHammingDistance instance with the specified comparison mode.
      Parameters:
      compareToCpdag - A boolean flag indicating whether the Structural Hamming Distance should be calculated by comparing the estimated graph to the CPDAG (Completed Partially Directed Acyclic Graph) of the true graph. If true, the calculation uses the CPDAG; otherwise, it uses the original PDAG (Partially Directed Acyclic Graph) of the true graph.
  • Method Details

    • getAbbreviation

      public String getAbbreviation()
      The abbreviation for the statistic. This will be printed at the top of each column.
      Specified by:
      getAbbreviation in interface Statistic
      Returns:
      This abbreviation.
    • getDescription

      public String getDescription()
      Returns a short one-line description of this statistic. This will be printed at the beginning of the report.
      Specified by:
      getDescription in interface Statistic
      Returns:
      This description.
    • getValue

      public double getValue(Graph trueGraph, Graph estGraph, DataModel dataModel, Parameters parameters)
      Returns the value of this statistic, given the true graph and the estimated graph.
      Specified by:
      getValue in interface Statistic
      Parameters:
      trueGraph - The true graph (DAG, CPDAG, PAG_of_the_true_DAG).
      estGraph - The estimated graph (same type).
      dataModel - The data model (can be null).
      parameters - The parameters (can be null).
      Returns:
      The value of the statistic.
    • getNormValue

      public double getNormValue(double value)
      Returns a mapping of the statistic to the interval [0, 1], with higher being better. This is used for a calculation of a utility for an algorithm. If the statistic is already between 0 and 1, you can just return the statistic.
      Specified by:
      getNormValue in interface Statistic
      Parameters:
      value - The value of the statistic.
      Returns:
      The weight of the statistic, 0 to 1, higher is better.