TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
←

127. Train/Val Leakage Detector

Medium

Given hashes (or unique IDs) of rows in your training and validation sets, return the indices in the validation set whose hash also appears in the training set.

Signature: def find_leakage(train: list, val: list) -> list

Return validation indices in ascending order. Use a set for the training data to make lookup O(1).

Math

leak(v)={i:vi​∈train}

Asked at

NumPy

import numpy as np

 

def find_leakage(...):

    pass

🔒

Premium problem

Free accounts include problems #1–20. Upgrade to unlock the editor, hidden test cases, and reference solutions for every problem.

Upgrade to PremiumBack to problems

Already premium?