chainer_chemistry.training.extensions.roc_auc_evaluator.ROCAUCEvaluator¶
-
class
chainer_chemistry.training.extensions.roc_auc_evaluator.
ROCAUCEvaluator
(iterator, target, converter=<function concat_examples>, device=None, eval_hook=None, eval_func=None, name=None, pos_labels=1, ignore_labels=None, raise_value_error=True, logger=None)[source]¶ Evaluator which calculates ROC AUC score
Note that this Evaluator is only applicable to binary classification task.
Parameters: - iterator – Dataset iterator for the dataset to calculate ROC AUC score.
It can also be a dictionary of iterators. If this is just an
iterator, the iterator is registered by the name
'main'
. - target – Link object or a dictionary of links to evaluate. If this is
just a link object, the link is registered by the name
'main'
. - converter – Converter function to build input arrays and true label.
concat_examples()
is used by default. It is expected to return input arrays of the form [x_0, …, x_n, t], where x_0, …, x_n are the inputs to the evaluation function and t is the true label. - device – Device to which the training data is sent. Negative value indicates the host memory (CPU).
- eval_hook – Function to prepare for each evaluation process. It is called at the beginning of the evaluation. The evaluator extension object is passed at each call.
- eval_func – Evaluation function called at each iteration. The target link to evaluate as a callable is used by default.
- name (str) – name of this extension. When name is None, default_name=’validation’ which is defined in super class Evaluator is used as extension name. This name affects to the reported key name.
- pos_labels (int or list) – labels of the positive class, other classes are considered as negative.
- ignore_labels (int or list or None) – labels to be ignored. None is used to not ignore all labels.
- raise_value_error (bool) – If False, ValueError caused by roc_auc_score calculation is suppressed and ignored with a warning message.
- logger –
-
converter
¶ Converter function.
-
device
¶ Device to which the training data is sent.
-
eval_hook
¶ Function to prepare for each evaluation process.
-
eval_func
¶ Evaluation function called at each iteration.
-
__init__
(iterator, target, converter=<function concat_examples>, device=None, eval_hook=None, eval_func=None, name=None, pos_labels=1, ignore_labels=None, raise_value_error=True, logger=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(iterator, target[, converter, …])Initialize self. evaluate
()Evaluates the model and returns a result dictionary. finalize
()Finalizes the evaluator object. get_all_iterators
()Returns a dictionary of all iterators. get_all_targets
()Returns a dictionary of all target links. get_iterator
(name)Returns the iterator of the given name. get_target
(name)Returns the target link of the given name. initialize
(trainer)Initializes up the trainer state. roc_auc_score
(y_total, t_total)serialize
(serializer)Serializes the extension state. Attributes
default_name
name
priority
trigger
- iterator – Dataset iterator for the dataset to calculate ROC AUC score.
It can also be a dictionary of iterators. If this is just an
iterator, the iterator is registered by the name