skada.metrics.CircularValidation

class skada.metrics.CircularValidation(source_scorer=<function balanced_accuracy_score>, greater_is_better=True)[source]

Score based on a circular validation strategy.

This scorer retrain the estimator, with the exact same parameters, on the predicted target domain samples. Then, the retrained estimator is used to predict the source domain labels. The score is then computed using the source_scorer between the true source labels and the predicted source labels.

See [11] for details.

Parameters:
source_scorercallable, default = sklearn.metrics.balanced_accuracy_score

Scorer used on the source domain samples. It should be a callable of the form source_scorer(y, y_pred).

greater_is_betterbool, default=False

Whether scorer is a score function (default), meaning high is good, or a loss function, meaning low is good. In the latter case, the scorer object will sign-flip the outcome of the scorer.

References

[11]

Bruzzone, L., & Marconcini, M. 'Domain adaptation problems: A DASVM classification technique and a circular validation strategy.' IEEE transactions on pattern analysis and machine intelligence, (2009).

set_score_request(*, sample_domain: bool | None | str = '$UNCHANGED$') CircularValidation

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:
sample_domainstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_domain parameter in score.

Returns:
selfobject

The updated object.