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

      Find your twin

      To learn what photos show without any labels, a model gets two crops of each photo and has to tell which crops belong together. For one crop, the model scores how alike it is to every crop in the batch (“Invent the score”, from −1 to 1). twin is the index of the other crop of the same photo; the rest are strangers. Write twin_loss(similarities, twin, temperature): one number training pushes down, lower when the crop picks out its twin better. temperature sets how sharply it picks (“Confident or cautious”).

      One crop of a dog photo has a twin, the other crop of the same photo, somewhere in a batch of crops; the rest are strangers. The model scores how alike each crop is to this one. Watch two batches, then drag the strangers around.

      A dog photo, cut into two crops. The model has to find this crop’s twin in a batch of crops.dog ½this crophow alike is each crop in the batch to it? (−1 to 1)batch A−1 unlike01 alikea cata cara beachtwin · 0.91 − twin’s score0.1the loss?batch B−1 unlike01 alikea terriera puppya poodletwin · 0.91 − twin’s score0.1the loss?twin_loss → low when the twin stands out, high when strangers crowd it
      Your functiontwin_loss(similarities, twin, temperature)
      similaritieshow alike this crop is to each crop in the batch (-1 to 1)e.g. [0.9, 0.95, 0.95, 0.95]
      twinthe index of the other crop of the same photoe.g. 0
      temperaturehow sharply to pick (small = sharp)e.g. 0.1
      returnsone number: lower = it picks out its twin better
      solution.pyLoading Python
      Sign in for an AI hint
      ← The greedy trapA small change to a big matrix →