INNER CODE UNIT · Python
ind
AnotherSamWilson/miceforest · miceforest/imputation_kernel.py:617
ind = hashed_seeds % mean_match_candidates
index_choice = knn_indices[np.arange(num_bachelors), ind]
imp_values = candidate_values.iloc[index_choice]
return imp_values
@staticmethod
def _mean_match_binary_fast(
mean_match_candidates: int,
bachelor_preds: DataFrame,
random_state: np.random.RandomState,
hashed_seeds: Optional[np.ndarray],
) -> np.ndarray:
"""
Chooses 0/1 randomly weighted by probability obtained from prediction.
If mean_match_candidates is 0, choose class with highest probability.