U {Ph @sPddlmZddlmZddlmZddlmZddlm Z GdddeZ dS) ) annotations)Callable)IgniteMetricHandler) ROCAUCMetric)Averagecs6eZdZdZejddfddddfdd ZZS) ROCAUCai Computes Area Under the Receiver Operating Characteristic Curve (ROC AUC). accumulating predictions and the ground-truth during an epoch and applying `compute_roc_auc`. Args: average: {``"macro"``, ``"weighted"``, ``"micro"``, ``"none"``} Type of averaging performed if not binary classification. Defaults to ``"macro"``. - ``"macro"``: calculate metrics for each label, and find their unweighted mean. This does not take label imbalance into account. - ``"weighted"``: calculate metrics for each label, and find their average, weighted by support (the number of true instances for each label). - ``"micro"``: calculate metrics globally by considering each element of the label indicator matrix as a label. - ``"none"``: the scores for each class are returned. output_transform: callable to extract `y_pred` and `y` from `ignite.engine.state.output` then construct `(y_pred, y)` pair, where `y_pred` and `y` can be `batch-first` Tensors or lists of `channel-first` Tensors. the form of `(y_pred, y)` is required by the `update()`. `engine.state` and `output_transform` inherit from the ignite concept: https://pytorch.org/ignite/concepts.html#state, explanation and usage example are in the tutorial: https://github.com/Project-MONAI/tutorials/blob/master/modules/batch_output_transform.ipynb. Note: ROCAUC expects y to be comprised of 0's and 1's. y_pred must either be probability estimates or confidence values. cCs|S)N)xrrK/home/dell461/cl/sdc2/HISourceFinder-master-l/src/monai/handlers/roc_auc.py3zROCAUC.z Average | strrNone)averageoutput_transformreturncs$tt|d}tj||dddS)N)rF) metric_fnr save_details)rrsuper__init__)selfrrr __class__rr r3szROCAUC.__init__)__name__ __module__ __qualname____doc__rMACROr __classcell__rrrr rsrN) __future__rcollections.abcrmonai.handlers.ignite_metricr monai.metricsr monai.utilsrrrrrr  s