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
      52 of 102

      At least one right

      A model answered the same coding question tries times, and correct of those answers pass the tests. You pick k different answers at random and run them. Write pass_at_k(tries, correct, k): the chance at least one of your k is right.

      A model wrote 10 answers to a coding question, and 3 of them pass the tests (filled in, marked ✓). You pick 2 different ones at random and run them. Some draws find a right answer, some don’t. Your function gives the chance a draw finds one.

      10 answers, 3 right; pick 2rightwrong✓✗✗✗✗✓✗✗✗✓chance at least one of your 2 picks is right0%50%100%?
      Your functionpass_at_k(tries, correct, k)
      trieshow many answers the model wrotee.g. 10
      correcthow many of them are righte.g. 3
      khow many different answers you pick at randome.g. 1
      returnsthe chance at least one of your k is right
      solution.pyLoading Python
      Sign in for an AI hint
      ← Pick the sick oneHow wrong is the forecast? →