:py:mod:`rhino_health.lib.metrics.base_metric` ============================================== .. py:module:: rhino_health.lib.metrics.base_metric Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: rhino_health.lib.metrics.base_metric.DataFilter rhino_health.lib.metrics.base_metric.GroupingData rhino_health.lib.metrics.base_metric.MetricResponse rhino_health.lib.metrics.base_metric.KaplanMeierMetricResponse rhino_health.lib.metrics.base_metric.TwoByTwoTableMetricResponse rhino_health.lib.metrics.base_metric.BaseMetric rhino_health.lib.metrics.base_metric.JoinMode Attributes ~~~~~~~~~~ .. autoapisummary:: rhino_health.lib.metrics.base_metric.MetricResultDataType .. py:class:: DataFilter(**data: Any) Bases: :py:obj:`pydantic.BaseModel` A filter to be applied on the entire Dataset .. !! processed by numpydoc !! .. py:attribute:: filter_column :type: str The column in the remote dataset df to check against .. !! processed by numpydoc !! .. py:attribute:: filter_value :type: Union[Any, rhino_health.lib.metrics.filter_variable.FilterBetweenRange] The value to match against or a FilterBetweenRange if filter_type is FilterType.BETWEEN .. !! processed by numpydoc !! .. py:attribute:: filter_type :type: Optional[rhino_health.lib.metrics.filter_variable.FilterType] The type of filtering to perform. Defaults to FilterType.EQUAL .. !! processed by numpydoc !! .. py:attribute:: filter_dataset :type: Optional[str] The dataset to perform the filter on if there are multiple datasets for Federated Join. If unspecified will be all datasets .. !! processed by numpydoc !! .. py:class:: GroupingData(**data: Any) Bases: :py:obj:`pydantic.BaseModel` Configuration for grouping metric results .. seealso:: :obj:`pandas.groupby` Implementation used for grouping. `See documentation `_ .. !! processed by numpydoc !! .. py:attribute:: groupings :type: List[str] :value: [] A list of columns to group metric results by .. !! processed by numpydoc !! .. py:attribute:: dropna :type: Optional[bool] :value: True Should na values be dropped if in a grouping key .. !! processed by numpydoc !! .. py:data:: MetricResultDataType Dict[str, Any] .. !! processed by numpydoc !! .. py:class:: MetricResponse(**data) Bases: :py:obj:`pydantic.BaseModel` Standardized response from querying metrics against a Dataset .. !! processed by numpydoc !! .. py:attribute:: output :type: MetricResultDataType .. py:attribute:: metric_configuration_dict :type: Optional[Dict[str, Any]] .. py:class:: KaplanMeierMetricResponse(**data) Bases: :py:obj:`MetricResponse` Standardized response from querying metrics against a Dataset .. !! processed by numpydoc !! .. py:attribute:: time_variable :type: str .. py:attribute:: event_variable :type: str .. py:method:: surv_func_right_model(group=None) Creates a survival function model for the metric response .. !! processed by numpydoc !! .. py:class:: TwoByTwoTableMetricResponse(**data) Bases: :py:obj:`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:: get_ordered_dict_table(table_data: dict) :staticmethod: Returns the table data as an ordered dict representing a 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:class:: BaseMetric(**data: Any) Bases: :py:obj:`pydantic.BaseModel` Parameters available for every metric .. !! processed by numpydoc !! .. py:property:: metric_response .. py:attribute:: data_filters :type: Optional[List[DataFilter]] :value: [] .. py:attribute:: group_by :type: Optional[GroupingData] .. py:attribute:: timeout_seconds :type: Optional[float] :value: 600.0 .. py:attribute:: count_variable_name :type: str :value: 'variable' .. py:method:: data() .. py:class:: JoinMode Bases: :py:obj:`str`, :py:obj:`enum.Enum` The mode we are performing the FederatedJoin .. !! processed by numpydoc !! .. py:attribute:: INTERSECTION :value: 'intersection' Return values where the identifiers are found in both the filter and query datasets. .. !! processed by numpydoc !! .. py:attribute:: UNION :value: 'union' Returns values where rows with the same identifiers are deduplicated. .. !! processed by numpydoc !!