module prediction.evaluation.measures.noise_variability

Noise Variability Measure.

This function returns the noise variability of a predictor. This measure corresponds to the mean difference of a performance measure when perturbing the input with noise. It is hence an indication of a predictor's stability under noisy inputs.

Copyright (C) 2022 Johannes Haug.


function noise_variability

noise_variability(
    y_true: Union[numpy._array_like._SupportsArray[numpy.dtype], numpy._nested_sequence._NestedSequence[numpy._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]],
    y_pred: Union[numpy._array_like._SupportsArray[numpy.dtype], numpy._nested_sequence._NestedSequence[numpy._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]],
    X: Union[numpy._array_like._SupportsArray[numpy.dtype], numpy._nested_sequence._NestedSequence[numpy._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]],
    predictor: float.prediction.base_predictor.BasePredictor,
    reference_measure: Callable = <function zero_one_loss at 0x11d1669d0>,
    reference_measure_kwargs: Optional[dict] = None,
    cont_noise_loc: float = 0,
    cont_noise_scale: float = 0.1,
    cat_features: Optional[list] = None,
    cat_noise_dist: Optional[List[list]] = None,
    n_samples: int = 10,
    rng: numpy.random._generator.Generator = Generator(PCG64) at 0x128EB4040
) → float

Calculates the variability of a predictor under input noise.

Args:

  • y_true: True target labels.
  • y_pred: Predicted target labels.
  • X: Array/matrix of observations.
  • predictor: Predictor object.
  • reference_measure: Evaluation measure function.
  • reference_measure_kwargs: Keyword arguments of the reference measure.
  • cont_noise_loc: Location (mean) of a normal distribution from which we sample noise for continuous features.
  • cont_noise_scale: Scale (variance) of a normal distribution from which we sample noise for continuous features.
  • cat_features: List of indices that correspond to categorical features.
  • cat_noise_dist: List of lists, where each list contains the noise values of one categorical feature.
  • n_samples: Number of times we sample noise and investigate divergence from the original loss.
  • rng: A numpy random number generator object. The global random state of the pipeline will be used to this end.

Returns:

  • float: Mean difference to the original loss for n input perturbations.

This file was automatically generated via lazydocs.