INNER CODE UNIT · Python
k
AnotherSamWilson/miceforest · miceforest/imputation_kernel.py:604
bachelor_preds, k=mean_match_candidates, workers=-1
)
# We can skip the random selection process if mean_match_candidates == 1
if mean_match_candidates == 1:
index_choice = knn_indices
else:
# Use the random_state if seed_array was not passed. Faster
if hashed_seeds is None:
ind = random_state.randint(mean_match_candidates, size=(num_bachelors))
# Use the random_seed_array if it was passed. Deterministic.
else:
ind = hashed_seeds % mean_match_candidates
index_choice = knn_indices[np.arange(num_bachelors), ind]
imp_values = candidate_values.iloc[index_choice]