Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      51 of 102

      Pick the sick one

      A blood test gives each patient a score: higher means more likely sick. Write ranking_score(scores, sick): how good the test is at ranking sick patients above healthy ones, before anyone chooses a cutoff. sick[i] is 1 if patient i is sick and 0 if healthy. 1 means perfect, 0.5 a coin flip, 0 exactly backwards.

      Four patients take the test. Ben and Ana are healthy, Cy and Di are sick. Lined up by score, how well did the test put the sick ones on top? Your function answers with one number.

      four patientssickhealthyas listedlower scorehigher score: more likely sick0.10.40.350.8Ana0.1Ben0.4Cy0.35Di0.8ranking score0 backwards0.5 coin flip1 perfect?
      Your functionranking_score(scores, sick)
      scoresthe test's score for each patient, higher = more likely sicke.g. [0.7, 0.8, 0.9, 0.95]
      sick1 if that patient is sick, 0 if healthye.g. [0, 0, 1, 1]
      returnshow well the scores rank sick above healthy:
      solution.pyLoading Python
      Sign in for an AI hint
      ← Grade a spam filterAt least one right →