rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics#

Module Contents#

Classes#

TwoByTwoTableBasedMetric

Abstract class for metrics that are based on a two by two table

TwoByTwoTable

Returns the two by two table of entries for a specified VARIABLE

OddsRatio

Returns the odds ratio of entries for a specified VARIABLE

Odds

Returns the odds of entries for a specified VARIABLE where the odd is calculated by the ratio of the number of true

Risk

Returns the risk of entries for a specified VARIABLE

RiskRatio

Returns the risk ratio of entries for a specified VARIABLE

TwoByTwoTableMetricResponse

Standardized response from querying metrics against a Dataset

class rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.TwoByTwoTableBasedMetric(**kwargs)#

Bases: rhino_health.lib.metrics.base_metric.AggregatableMetric, abc.ABC

Abstract class for metrics that are based on a two by two table

variable: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName | None#
detected_column_name: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName#
exposed_column_name: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName#
classmethod warn_if_variable_used(value)#
class rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.TwoByTwoTable(**kwargs)#

Bases: TwoByTwoTableBasedMetric

Returns the two by two table of entries for a specified VARIABLE

property metric_response#

Returns the response class for the metric

classmethod warn_if_variable_used(value)#
class rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.OddsRatio(**kwargs)#

Bases: TwoByTwoTableBasedMetric

Returns the odds ratio of entries for a specified VARIABLE

class rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.Odds(**kwargs)#

Bases: rhino_health.lib.metrics.base_metric.AggregatableMetric

Returns the odds of entries for a specified VARIABLE where the odd is calculated by the ratio of the number of true

occurrences to the number of false occurrences.

variable: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName | None#
column_name: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName#
classmethod warn_if_variable_used(value)#
class rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.Risk(**kwargs)#

Bases: TwoByTwoTableBasedMetric

Returns the risk of entries for a specified VARIABLE

class rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.RiskRatio(**kwargs)#

Bases: TwoByTwoTableBasedMetric

Returns the risk ratio of entries for a specified VARIABLE

class rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.TwoByTwoTableMetricResponse(**data)#

Bases: rhino_health.lib.metrics.base_metric.MetricResponse

Standardized response from querying metrics against a Dataset

as_table()#

Display the 2X2 table metric response as a dict representing a table. Use pd.DataFrame(as_table_result) to visualize the table. The data provided should represent a 2X2 table meaning the dict is of length 4, the keys should be tuples of length 2 representing the possible combination of values. The “detected” values are the columns and the “exposed” values are the rows. If the data is boolean, the table order is (true, false) for both columns and rows. If not, the order is alphabetical.

as_dataframe()#

Display the 2X2 table metric response as a pandas DataFrame.

risk(detected_column_name=None, exposed_column_name=None)#
risk_ratio(detected_column_name=None, exposed_column_name=None)#
odds(column_name)#
odds_ratio(detected_column_name=None, exposed_column_name=None)#