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

      Where does the weather settle?

      In these towns, tomorrow’s weather depends only on today’s: tomorrow[i][j] is the chance that tomorrow is weather j when today is weather i. Write long_run_shares(tomorrow): the share of days in each weather over the long run, one share per weather, in the table’s order.

      In Sunnyvale, a sunny day is followed by sun 80% of the time and a rainy day by sun 60% of the time. The obvious guess is 80% sunny days. Follow the chances day by day instead, from a sunny first day and from a rainy one: both settle into the same mix, and it isn’t 80/20. The goal is that mix. Your long_run_shares() works it out.

      In Sunnyvale, tomorrow’s weather depends only on today’s.tomorrow, after a…sunny day80%20%rainy day60%40%sunnyrainythe chances on each day, from day 0 to day 10start sunnystart rainyguess
      Your functionlong_run_shares(tomorrow)
      tomorrowtomorrow[i][j] is the chance tomorrow is weather j when today is weather i (a numpy array, each row adds up to 1)e.g. [[0.7, 0.3], [0.3, 0.7]]
      returnsthe long-run share of days in each weather, in the table's order, adding up to 1, e.g. [0.6, 0.4]
      solution.pyLoading Python
      Sign in for an AI hint
      ← Darts at a squareIs the bet worth it? →