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
      64 of 130

      Better in every hospital

      Hospitals tried a new treatment, and each reports how many patients got it and recovered, and how many didn’t get it and recovered. Write treatment_effect(hospitals): how much the treatment changes the recovery rate, as a share (0.1 = 10 points better), meaning the difference you would see if every hospital’s patients got it versus if none did.

      Two hospitals tried a new treatment. In each one, the patients who got it recovered more often. Lump everyone together, and the patients who got it did worse: most of them were in City, where patients are sicker. The goal is one number for what the treatment does, the way each hospital sees it. Your treatment_effect() works it out.

      Two hospitals tried a new treatment. City’s patients are sicker.City · 200 patientsgot it40%didn’t30%▲ +0.10 insideHill · 200 patientsgot it90%didn’t85%▲ +0.05 insideeveryone, lumpedgot it50%didn’t74%▼ −0.24 flippedchange in recovery−0.30−0.150+0.15+0.30worsebetterCityHilllumped
      Your functiontreatment_effect(hospitals)
      hospitalsone row per hospital, [treated_recovered, treated_total, untreated_recovered, untreated_total] (a list of lists)e.g. [[30, 40, 20, 40]]
      returnshow much the treatment changes the recovery rate, e.g. 0.1 for 10 points better, -0.1 for worse
      solution.pyLoading Python
      Sign in for an AI hint
      ← Twenty jelly beansThe worst got better →