Module markov.api.utils.sampling_strategy

Classes

class AbsSamplingStrategy

Abstract class for enforcing sampling contract

Subclasses

Methods

def sample(self, df: pandas.core.frame.DataFrame, n: int = 10000, **kwargs) ‑> pandas.core.frame.DataFrame
class ClusterSampling

Abstract class for enforcing sampling contract

Ancestors

Methods

def sample(self, df: pandas.core.frame.DataFrame, n: int = 10000, **kwargs) ‑> pandas.core.frame.DataFrame
class EqualSplitSampling

Returned sample where each class has equivalent representation. For example in a dataset with two classes A (60%) and B(40%) if n samples are requested , for n/2 > number of samples of A and number of samples of B, we will return n/2 examples from class and n/2 example from class B. If num B or num A < n/2 samples returned are min(num A, num B)*2.

Ancestors

Methods

def sample(self, df: pandas.core.frame.DataFrame, n: int = 10000, **kwargs) ‑> pandas.core.frame.DataFrame
class SimpleRandomSampling

Implements contract from Random Sampling

Ancestors

Methods

def sample(self, df: pandas.core.frame.DataFrame, n: int = 10000, **kwargs) ‑> pandas.core.frame.DataFrame
class StratifiedSampling

Return the Samples in proportion of their target label distribution. This is broadly defined as stratified sampling

Ancestors

Methods

def sample(self, df: pandas.core.frame.DataFrame, n: int = 10000, **kwargs) ‑> pandas.core.frame.DataFrame
class WeightedSampling

Sample distribution as per the probability distribution specified by the user. Class weights should sum to 1. If the class Weights do not sum to 1, exception would be thrown

Ancestors

Methods

def sample(self, df: pandas.core.frame.DataFrame, n: int = 10000, **kwargs) ‑> pandas.core.frame.DataFrame