:py:mod:`rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics` ============================================================================== .. py:module:: rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.TwoByTwoTableBasedMetric rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.TwoByTwoTable rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.OddsRatio rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.Odds rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.Risk rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.RiskRatio rhino_health.lib.metrics.epidemiology.two_by_two_table_based_metrics.TwoByTwoTableMetricResponse .. py:class:: TwoByTwoTableBasedMetric(**kwargs) Bases: :py:obj:`rhino_health.lib.metrics.base_metric.AggregatableMetric`, :py:obj:`abc.ABC` Abstract class for metrics that are based on a two by two table .. !! processed by numpydoc !! .. py:attribute:: variable :type: Optional[rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName] .. py:attribute:: detected_column_name :type: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName .. py:attribute:: exposed_column_name :type: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName .. py:method:: warn_if_variable_used(value) :classmethod: .. py:class:: TwoByTwoTable(**kwargs) Bases: :py:obj:`TwoByTwoTableBasedMetric` Returns the two by two table of entries for a specified VARIABLE .. !! processed by numpydoc !! .. py:property:: metric_response Returns the response class for the metric .. !! processed by numpydoc !! .. py:method:: warn_if_variable_used(value) :classmethod: .. py:class:: OddsRatio(**kwargs) Bases: :py:obj:`TwoByTwoTableBasedMetric` Returns the odds ratio of entries for a specified VARIABLE .. !! processed by numpydoc !! .. py:class:: Odds(**kwargs) Bases: :py:obj:`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. .. !! processed by numpydoc !! .. py:attribute:: variable :type: Optional[rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName] .. py:attribute:: column_name :type: rhino_health.lib.metrics.filter_variable.FilterVariableTypeOrColumnName .. py:method:: warn_if_variable_used(value) :classmethod: .. py:class:: Risk(**kwargs) Bases: :py:obj:`TwoByTwoTableBasedMetric` Returns the risk of entries for a specified VARIABLE .. !! processed by numpydoc !! .. py:class:: RiskRatio(**kwargs) Bases: :py:obj:`TwoByTwoTableBasedMetric` Returns the risk ratio of entries for a specified VARIABLE .. !! processed by numpydoc !! .. py:class:: TwoByTwoTableMetricResponse(**data) Bases: :py:obj:`rhino_health.lib.metrics.base_metric.MetricResponse` Standardized response from querying metrics against a Dataset .. !! processed by numpydoc !! .. py:method:: 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. .. !! processed by numpydoc !! .. py:method:: as_dataframe() Display the 2X2 table metric response as a pandas DataFrame. .. !! processed by numpydoc !! .. py:method:: risk(detected_column_name=None, exposed_column_name=None) .. py:method:: risk_ratio(detected_column_name=None, exposed_column_name=None) .. py:method:: odds(column_name) .. py:method:: odds_ratio(detected_column_name=None, exposed_column_name=None)