How to use the xskillscore.brier_score function in xskillscore

To help you get started, we’ve selected a few xskillscore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bradyrx / climpred / climpred / metrics.py View on Github external
Example:
        >>> def pos(x): return x > 0
        >>> compute_perfect_model(ds, control, metric='brier_score', logical=pos)
    """
    if 'logical' in metric_kwargs:
        logical = metric_kwargs['logical']
        if not callable(logical):
            raise ValueError(f'`logical` must be `callable`, found {type(logical)}')
    else:
        raise ValueError(
            'Please provide a callable `logical` to be applied to comparison and \
             verification data to get values in  interval [0,1]; \
             see properscoring.brier_score.'
        )
    return brier_score(logical(verif), logical(forecast).mean('member'))