NPP#

class mlquantify.evaluation.protocol.NPP(batch_size, random_state=None, **kwargs)[source]#

No Prevalence Protocol (NPP) for evaluation. This protocol just samples the data without any consideration for prevalence, with all instances having equal probability of being selected.

Parameters:
batch_sizeint or list of int

The size of the batches to be used in the evaluation.

random_stateint, optional

The random seed for reproducibility.

Attributes:
n_prevalencesint

The number of artificial prevalences to generate.

repeatsint

The number of times to repeat the evaluation with different random seeds.

random_stateint

The random seed for reproducibility.

Examples

>>> protocol = NPP(batch_size=100, random_state=42)
>>> for train_idx, test_idx in protocol.split(X, y):
...     # Train and evaluate model
...     pass
get_n_combinations() int[source]#

Get the number of combinations for the current protocol.

split(X: ndarray, y: ndarray)[source]#

Split the data into samples for evaluation.

Parameters:
Xnp.ndarray

The input features.

ynp.ndarray

The target labels.

Yields:
Generator[np.ndarray, np.ndarray]

A generator that yields the indices for each split.