causal_testing.testing.causal_effect
This module contains the CausalEffect abstract class, as well as the concrete extension classes: ExactValue, Positive, Negative, SomeEffect, NoEffect
Module Contents
Classes
An abstract class representing an expected causal effect. |
|
An extension of CausalEffect representing that the expected causal effect should not be zero. |
|
An extension of CausalEffect representing that the expected causal effect should be zero. |
|
An extension of CausalEffect representing that the expected causal effect should be a specific value. |
|
An extension of CausalEffect representing that the expected causal effect should be positive. |
|
An extension of CausalEffect representing that the expected causal effect should be negative. |
- class causal_testing.testing.causal_effect.CausalEffect(effect_type: str = 'direct')
Bases:
abc.ABCAn abstract class representing an expected causal effect.
- abstract apply(effect_estimate: causal_testing.estimation.effect_estimate.EffectEstimate) bool
Abstract apply method that should return a bool representing if the result meets the outcome :param effect_estimate: EffectEstimate to be checked :return: Bool that is true if outcome is met
- __str__() str
Return str(self).
- to_dict()
Convert the expected effect to a python dictionary for easy serialisation as JSON.
- Returns:
A JSON serialisable dict representing the expected effect.
- class causal_testing.testing.causal_effect.SomeEffect(effect_type: str = 'direct')
Bases:
CausalEffectAn extension of CausalEffect representing that the expected causal effect should not be zero.
- apply(effect_estimate: causal_testing.estimation.effect_estimate.EffectEstimate) bool
Abstract apply method that should return a bool representing if the result meets the outcome :param effect_estimate: EffectEstimate to be checked :return: Bool that is true if outcome is met
- class causal_testing.testing.causal_effect.NoEffect(effect_type: str = 'direct', atol: float = 0, ctol: float = 0.0)
Bases:
CausalEffectAn extension of CausalEffect representing that the expected causal effect should be zero. :param atol: Arithmetic tolerance. The test will pass if the absolute value of the causal effect is less than atol. :param ctol: Categorical tolerance. The test will pass if this proportion of categories pass.
- apply(effect_estimate: causal_testing.estimation.effect_estimate.EffectEstimate) bool
Abstract apply method that should return a bool representing if the result meets the outcome :param effect_estimate: EffectEstimate to be checked :return: Bool that is true if outcome is met
- to_dict()
Convert the expected effect to a python dictionary for easy serialisation as JSON.
- Returns:
A JSON serialisable dict representing the expected effect.
- class causal_testing.testing.causal_effect.ExactValue(value: float, effect_type: str = 'direct', atol: float = 0, ci_low: float = None, ci_high: float = None)
Bases:
CausalEffectAn extension of CausalEffect representing that the expected causal effect should be a specific value.
- apply(effect_estimate: causal_testing.estimation.effect_estimate.EffectEstimate) bool
Abstract apply method that should return a bool representing if the result meets the outcome :param effect_estimate: EffectEstimate to be checked :return: Bool that is true if outcome is met
- __str__()
Return str(self).
- to_dict()
Convert the expected effect to a python dictionary for easy serialisation as JSON or CSV.
- Returns:
A JSON serialisable dict representing the expected effect.
- class causal_testing.testing.causal_effect.Positive(effect_type: str = 'direct')
Bases:
SomeEffectAn extension of CausalEffect representing that the expected causal effect should be positive. Currently only single values are supported for the test value
- apply(effect_estimate: causal_testing.estimation.effect_estimate.EffectEstimate) bool
Abstract apply method that should return a bool representing if the result meets the outcome :param effect_estimate: EffectEstimate to be checked :return: Bool that is true if outcome is met
- class causal_testing.testing.causal_effect.Negative(effect_type: str = 'direct')
Bases:
SomeEffectAn extension of CausalEffect representing that the expected causal effect should be negative. Currently only single values are supported for the test value
- apply(effect_estimate: causal_testing.estimation.effect_estimate.EffectEstimate) bool
Abstract apply method that should return a bool representing if the result meets the outcome :param effect_estimate: EffectEstimate to be checked :return: Bool that is true if outcome is met