Class StabilitySelection

java.lang.Object
edu.cmu.tetrad.algcomparison.algorithm.StabilitySelection
All Implemented Interfaces:
Algorithm, HasParameters, TetradSerializable, Serializable

public class StabilitySelection extends Object implements Algorithm
Stability selection: runs the wrapped algorithm on resamples of the data and returns the graph containing exactly those edges (with orientation) appearing in more than "percentStability" of the resample graphs.

Resampling and the resample searches are delegated to the shared machinery in ParameterSweep (drawResamples and searchOnResamples); this class keeps its historical edge-counting and thresholding semantics. Compared to the pre-2026 implementation, the resample draws are now seed-controllable via Params.SEED, resample graphs have their nodes replaced by the original variables before counting (so edges are comparable across resamples), and a concurrency hazard in the resample collection was removed. Note that a fixed seed makes the resampled row sets exactly reproducible but makes the output graph reproducible only if the wrapped algorithm is itself deterministic; algorithms with internal thread pools (e.g. FGES) can break score near-ties differently between runs, which can flip edges whose resample counts sit at the percentStability threshold.

Parameters read from the Parameters object: "numSubsamples", "percentSubsampleSize", "percentStability", and optionally Params.SEED.

Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • StabilitySelection

      public StabilitySelection(Algorithm algorithm)

      Constructor for StabilitySelection.

      Parameters:
      algorithm - a Algorithm object
  • Method Details

    • search

      public Graph search(DataModel dataSet, Parameters parameters)
      Runs the search.
      Specified by:
      search in interface Algorithm
      Parameters:
      dataSet - The data set to run to the search on.
      parameters - The paramters of the search.
      Returns:
      The result graph.
    • getComparisonGraph

      public Graph getComparisonGraph(Graph graph)
      Returns that graph that the result should be compared to.
      Specified by:
      getComparisonGraph in interface Algorithm
      Parameters:
      graph - The true directed graph, if there is one.
      Returns:
      The comparison graph.
    • getDescription

      public String getDescription()
      Returns a short, one-line description of this algorithm. This will be printed in the report.
      Specified by:
      getDescription in interface Algorithm
      Returns:
      This description.
    • getDataType

      public DataType getDataType()
      Returns the data type that the search requires, whether continuous, discrete, or mixed.
      Specified by:
      getDataType in interface Algorithm
      Returns:
      This type.
    • getParameters

      public List<String> getParameters()
      Returns the list of parameter names that are used. These are looked up in ParamMap, so if they're not
      Specified by:
      getParameters in interface HasParameters
      Returns:
      Returns the list of parameter names that are used. These are looked up in ParamMap, so if they're not already defined they'll need to be defined there.