Skip to content

Score Functions - Parameters and Constants

Score parameter constants, validation and graph size metrics used by the score module. They were extracted into this sibling module so that causaliq_data.score stays within the module size limits described in the development policy. Every name is re-exported from causaliq_data.score, so import paths are unchanged.

The score constants live in this module because the score kernels need them, and importing them from causaliq_data.score would create a circular import.

Parameter Checking

check_score_params

check_score_params(
    params: Dict[str, Any], scores: Optional[List[str]] = None
) -> Dict[str, Any]

Check score parameters specified by user and supply default values.

Parameters supported are
  • base: logarithm base used, 2, 10 or 'e'
  • iss: imaginary sample size, positive real
  • prior: structural prior, string 'uniform' or 'marginal'
  • k: complexity penalty multiplier

Parameters:

  • params

    (dict) –

    Parameters for scoring metrics.

  • scores

    (list / None, default: None ) –

    Score/list of scores which params used for.

Returns:

  • dict ( Dict[str, Any] ) –

    Of parameters {param: value}.

Raises:

  • TypeError –

    If invalid types used.

  • ValueError –

    If any invalid values, combinations specified.

Free Parameters

free_params

free_params(graph: Any, data: DataFrame, debug: bool = False) -> int

Compute number of free parameters for graph and data.

Parameters:

  • graph

    (DAG) –

    The dag to return value for.

  • data

    (DataFrame) –

    Data for the graph.

  • debug

    (bool, default: False ) –

    Whether details of node parameters printed.

Returns:

  • int ( int ) –

    Number of free params for graph with data.