Skip to content

phepy

OutOfDistributionDetector

Bases: abc.ABC

fit abstractmethod

fit(
    X_train: np.ndarray, Y_train: np.ndarray
) -> OutOfDistributionDetector
Source code in phepy/detector.py
@abc.abstractmethod
def fit(
    self, X_train: np.ndarray, Y_train: np.ndarray
) -> OutOfDistributionDetector:
    pass

low_score_is_low_confidence abstractmethod staticmethod

low_score_is_low_confidence() -> bool
Source code in phepy/detector.py
@staticmethod
@abc.abstractmethod
def low_score_is_low_confidence() -> bool:
    pass

predict abstractmethod

predict(X_test: np.ndarray) -> np.ndarray
Source code in phepy/detector.py
@abc.abstractmethod
def predict(self, X_test: np.ndarray) -> np.ndarray:
    pass

OutOfDistributionScorer

OutOfDistributionScorer(
    detector: OutOfDistributionDetector,
)

Bases: abc.ABC

Source code in phepy/detector.py
@abc.abstractmethod
def __init__(
    self, detector: OutOfDistributionDetector
) -> OutOfDistributionScorer:
    self.__detector = detector

calibrate abstractmethod

calibrate(
    X_valid: np.ndarray, Y_valid: np.ndarray
) -> OutOfDistributionScorer
Source code in phepy/detector.py
@abc.abstractmethod
def calibrate(
    self, X_valid: np.ndarray, Y_valid: np.ndarray
) -> OutOfDistributionScorer:
    pass

detector property

predict abstractmethod

predict(X_test: np.ndarray) -> np.ndarray

Predict the confidence scores for several test data inputs.

PARAMETER DESCRIPTION
X_test

numpy array of shape N_SAMPLES x N_FEATURES

TYPE: np.ndarray

RETURNS DESCRIPTION
np.ndarray

The array confidence scores of shape N_SAMPLES

Source code in phepy/detector.py
@abc.abstractmethod
def predict(self, X_test: np.ndarray) -> np.ndarray:
    """Predict the confidence scores for several test data inputs.

    Args:
      X_test:
        numpy array of shape `N_SAMPLES x N_FEATURES`

    Returns:
      The array confidence scores of shape `N_SAMPLES`
    """
    pass

ToyExample

Bases: abc.ABC

X_test abstractmethod property

X_test: np.ndarray

X_train abstractmethod property

X_train: np.ndarray

X_valid abstractmethod property

X_valid: np.ndarray

Y_train abstractmethod property

Y_train: np.ndarray

Y_valid abstractmethod property

Y_valid: np.ndarray

aspect_ratio abstractmethod property

aspect_ratio: float

is_in_distribution abstractmethod

is_in_distribution(X: np.ndarray) -> np.ndarray
Source code in phepy/toys/__init__.py
@abc.abstractmethod
def is_in_distribution(X: np.ndarray) -> np.ndarray:
    pass

plot abstractmethod

plot(
    conf: np.ndarray,
    ax: mpl.axes.Axes,
    cmap: Union[str, mpl.colors.Colormap],
    with_scatter: bool = True,
)
Source code in phepy/toys/__init__.py
@abc.abstractmethod
def plot(
    self,
    conf: np.ndarray,
    ax: mpl.axes.Axes,
    cmap: Union[str, mpl.colors.Colormap],
    with_scatter: bool = True,
):
    pass

reconstruct abstractmethod

reconstruct(X: np.ndarray) -> np.ndarray
Source code in phepy/toys/__init__.py
@abc.abstractmethod
def reconstruct(X: np.ndarray) -> np.ndarray:
    pass