Class SweepReport

java.lang.Object
edu.cmu.tetrad.algcomparison.sweep.SweepReport

public final class SweepReport extends Object
The full record of a ParameterSweep: the evaluated settings with their evidence (point graphs, resample edge probabilities, adjacency instability, Markov-check statistics, timing) plus enough configuration metadata to make the sweep reproducible. Serializable to markdown and JSON so that the evidence behind a parameter choice can be inspected, reported, or consumed by tools such as py-tetrad.

Selection among settings is a decision, not evidence, so the selection rules here are explicit methods a caller invokes (or overrides with their own judgment); nothing is selected implicitly. The provided rules are the two in common use: stability selection in the StARS sense and Markov adequacy.

Version:
$Id: $Id
Author:
josephramsey
  • Constructor Summary

    Constructors
    Constructor
    Description
    SweepReport(String algorithmDescription, String markovCheckDescription, int numRows, int numVariables, int numResamples, double percentResampleSize, boolean withReplacement, long seed, int numResampleGroups, List<SweepResult> results)
    Constructs a report, recording whether resampling was by row or by block.
    SweepReport(String algorithmDescription, String markovCheckDescription, int numRows, int numVariables, int numResamples, double percentResampleSize, boolean withReplacement, long seed, List<SweepResult> results)
    Constructs a report.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a description of the algorithm swept.
    Returns a description of the Markov-check test, or null if none was configured.
    int
    Returns the number of distinct groups if resampling was by block, or -1 if it was by row.
    Returns the per-setting results, in evaluation order, unmodifiable.
    long
    Returns the random seed used to draw the resamples, or -1 if time-seeded.
    selectByInstability(double instabilityCutoff)
    Selects by the StARS rule as implemented historically in Tetrad's StARS class: among settings whose adjacency instability is strictly below the cutoff, returns the one with the largest instability; returns null if no setting qualifies.
    Selects by Markov adequacy: the setting whose Anderson-Darling p-value for the implied independencies is largest (least evidence of asserting independencies the data reject), breaking ties by the larger fraction of implied dependencies detected.
    Selects the setting with the smallest adjacency instability, or null if no setting has a computed instability.
    Returns a JSON rendering of the report.
    Returns a markdown rendering of the report: a header describing the sweep and a table with one row per setting (setting, point-graph edge count, adjacency instability, Anderson-Darling p for implied independencies, fraction of implied dependencies detected, elapsed milliseconds).
    Returns the markdown rendering.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SweepReport

      public SweepReport(String algorithmDescription, String markovCheckDescription, int numRows, int numVariables, int numResamples, double percentResampleSize, boolean withReplacement, long seed, List<SweepResult> results)
      Constructs a report. Intended to be called by ParameterSweep.
      Parameters:
      algorithmDescription - a description of the algorithm swept.
      markovCheckDescription - a description of the Markov-check test, or null.
      numRows - the number of rows in the data.
      numVariables - the number of variables in the data.
      numResamples - the number of resamples per setting.
      percentResampleSize - the fraction of the sample size drawn per resample.
      withReplacement - whether resampling was with replacement.
      seed - the random seed used, or -1 if time-seeded.
      results - the per-setting results, in evaluation order.
    • SweepReport

      public SweepReport(String algorithmDescription, String markovCheckDescription, int numRows, int numVariables, int numResamples, double percentResampleSize, boolean withReplacement, long seed, int numResampleGroups, List<SweepResult> results)
      Constructs a report, recording whether resampling was by row or by block. Intended to be called by ParameterSweep.
      Parameters:
      algorithmDescription - a description of the algorithm swept.
      markovCheckDescription - a description of the Markov-check test, or null.
      numRows - the number of rows in the data.
      numVariables - the number of variables in the data.
      numResamples - the number of resamples per setting.
      percentResampleSize - the fraction of the sample size (rows, or groups for block resampling) drawn per resample.
      withReplacement - whether resampling was with replacement.
      seed - the random seed used, or -1 if time-seeded.
      numResampleGroups - the number of distinct groups for block resampling, or -1 for row resampling.
      results - the per-setting results, in evaluation order.
  • Method Details

    • getResults

      public List<SweepResult> getResults()
      Returns the per-setting results, in evaluation order, unmodifiable.
      Returns:
      These results.
    • getAlgorithmDescription

      public String getAlgorithmDescription()
      Returns a description of the algorithm swept.
      Returns:
      This description.
    • getMarkovCheckDescription

      public String getMarkovCheckDescription()
      Returns a description of the Markov-check test, or null if none was configured.
      Returns:
      This description or null.
    • getSeed

      public long getSeed()
      Returns the random seed used to draw the resamples, or -1 if time-seeded.
      Returns:
      This seed.
    • getNumResampleGroups

      public int getNumResampleGroups()
      Returns the number of distinct groups if resampling was by block, or -1 if it was by row.
      Returns:
      This count, or -1.
    • selectByInstability

      public SweepResult selectByInstability(double instabilityCutoff)
      Selects by the StARS rule as implemented historically in Tetrad's StARS class: among settings whose adjacency instability is strictly below the cutoff, returns the one with the largest instability; returns null if no setting qualifies. (The rationale: instability typically falls as regularization grows, so the largest sub-cutoff instability marks the least-regularized acceptable setting.) This is a defaulted decision rule, not evidence; callers may apply their own.
      Parameters:
      instabilityCutoff - the cutoff (StARS beta, commonly 0.05).
      Returns:
      the selected result, or null if none qualifies.
    • selectMostStable

      public SweepResult selectMostStable()
      Selects the setting with the smallest adjacency instability, or null if no setting has a computed instability. This is a defaulted decision rule, not evidence.
      Returns:
      the selected result, or null.
    • selectByMarkovAdequacy

      public SweepResult selectByMarkovAdequacy()
      Selects by Markov adequacy: the setting whose Anderson-Darling p-value for the implied independencies is largest (least evidence of asserting independencies the data reject), breaking ties by the larger fraction of implied dependencies detected. Returns null if no setting has Markov statistics. This is a defaulted decision rule, not evidence.
      Returns:
      the selected result, or null.
    • toMarkdown

      public String toMarkdown()
      Returns a markdown rendering of the report: a header describing the sweep and a table with one row per setting (setting, point-graph edge count, adjacency instability, Anderson-Darling p for implied independencies, fraction of implied dependencies detected, elapsed milliseconds).
      Returns:
      This rendering.
    • toJson

      public String toJson()
      Returns a JSON rendering of the report. Top-level fields: "algorithm", "markovCheck" (nullable), "numRows", "numVariables", "numResamples", "percentResampleSize", "withReplacement", "seed", and "results", the last an array of objects with fields "setting" (an object), "numEdges", "adjacencyInstability", "markov" (nullable object with the ten Markov statistics), and "elapsedMillis". Graphs themselves are not embedded; retrieve them from getResults().
      Returns:
      This rendering.
    • toString

      public String toString()
      Returns the markdown rendering.
      Overrides:
      toString in class Object
      Returns:
      This rendering.