mlm_insights.core.drift_algorithms package¶
Submodules¶
mlm_insights.core.drift_algorithms.chi_square module¶
- mlm_insights.core.drift_algorithms.chi_square.compute_chi_squared(reference_frequency_distribution: List[float], current_frequency_distribution: List[float], fill_zero: bool = True, epsilon_value: float = 0.0001) DriftAlgorithmResult ¶
Computes Chi Squared value for the provided distributions. The two frequency distributions must be of same length. Parameters ———- reference_frequency_distribution : Reference Frequency Distribution current_frequency_distribution : Current Frequency Distribution fill_zero : boolean to indicate if there are zero values in the distributions which need to be replaced with small number epsilon_value : a small number which would replace zero values in the distributions
mlm_insights.core.drift_algorithms.drift_algorithm_result module¶
mlm_insights.core.drift_algorithms.kolmogorov_smirnov_test module¶
- mlm_insights.core.drift_algorithms.kolmogorov_smirnov_test.compute_ks_test(reference_cdf: List[float], current_cdf: List[float], reference_data_length: int, current_data_length: int) DriftAlgorithmResult ¶
Computes KL Divergence value for the provided distributions. Parameters ———- reference_cdf : Reference Cumulative Distribution current_cdf : Target Cumulative Distribution reference_data_length : Data length of reference data current_data_length : Data length of current data
mlm_insights.core.drift_algorithms.kullback_leibler_divergence module¶
- mlm_insights.core.drift_algorithms.kullback_leibler_divergence.compute_kl_divergence(reference_pmf: List[float], current_pmf: List[float]) DriftAlgorithmResult ¶
Computes KL Divergence value for the provided distributions. Parameters ———- reference_pmf : Reference Probability Distribution current_pmf : Target Probability Distribution
mlm_insights.core.drift_algorithms.utils module¶
- mlm_insights.core.drift_algorithms.utils.fill_zeroes(array: Any, epsilon_value: float = 0.0001) None ¶
This function replaces the 0 values in an array with a smaller value. If the array contains any elements <= smaller value, it replaces with epsilon. This is required for certain drift algorithms to ensure the value generated is not an invalid one. For eg: if a denominator is a zero, this leads to division by zero error Parameters ———- array : Array to replace zero value epsilon_value : Float which replaces zero values in the array, default is 0.0001