causal_testing.specification.variable

This module contains the Variable abstract class, as well as its concrete extensions: Input, Output and Meta.

Module Contents

Classes

Variable

An abstract class representing causal variables.

Input

An extension of the Variable class representing inputs.

Output

An extension of the Variable class representing outputs.

Meta

An extension of the Variable class representing metavariables. These are variables which are relevant to the

Attributes

T

causal_testing.specification.variable.T
class causal_testing.specification.variable.Variable(name: str, datatype: T, distribution: scipy.stats._distn_infrastructure.rv_generic = None, hidden: bool = False)

Bases: abc.ABC

An abstract class representing causal variables.

Parameters:
  • name (str) – The name of the variable.

  • datatype (T) – The datatype of the variable.

  • distribution (rv_generic) – The expected distribution of the variable values.

Attr name:

Attr datatype:

Attr distribution:

Attr hidden:

name: str
datatype: T
distribution: scipy.stats._distn_infrastructure.rv_generic
__repr__()

Return repr(self).

typestring() str

Return the type of the Variable, e.g. INPUT, or OUTPUT. Note that this is NOT the datatype (int, str, etc.).

Returns:

A string representing the variable Type.

Return type:

str

copy(name: str = None) Variable

Return a new instance of the Variable with the given name, or with the original name if no name is supplied.

Parameters:

name (str) – The variable name.

Returns:

A new Variable instance.

Return type:

Variable

class causal_testing.specification.variable.Input(name: str, datatype: T, distribution: scipy.stats._distn_infrastructure.rv_generic = None, hidden: bool = False)

Bases: Variable

An extension of the Variable class representing inputs.

class causal_testing.specification.variable.Output(name: str, datatype: T, distribution: scipy.stats._distn_infrastructure.rv_generic = None, hidden: bool = False)

Bases: Variable

An extension of the Variable class representing outputs.

class causal_testing.specification.variable.Meta(name: str, datatype: T, populate: collections.abc.Callable[[pandas.DataFrame], pandas.DataFrame])

Bases: Variable

An extension of the Variable class representing metavariables. These are variables which are relevant to the _causal_ structure and properties we may want to test, but are not directly related to the computational model either as inputs or outputs.

Parameters:
  • name (str) – The name of the variable.

  • datatype (T) – The datatype of the variable.

  • populate (Callable[[DataFrame], DataFrame]) – Populate a given dataframe containing runtime data with the metavariable values as calculated from model inputs and ouputs.

Attr populate:

The populate function.

populate: collections.abc.Callable[[pandas.DataFrame], pandas.DataFrame]