BaşlayınÜcretsiz Başlayın

Define team lookup

Shared layers allow a model to use the same weight matrix for multiple steps. In this exercise, you will build a "team strength" layer that represents each team by a single number. You will use this number for both teams in the model. The model will learn a number for each team that works well both when the team is team_1 and when the team is team_2 in the input data.

The games_season DataFrame is available in your workspace.

Bu egzersiz

Advanced Deep Learning with Keras

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Count the number of unique teams.
  • Create an embedding layer that maps each team ID to a single number representing that team's strength.
  • The output shape should be 1 dimension (as we want to represent the teams by a single number).
  • The input length should be 1 dimension (as each team is represented by exactly one id).

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Imports
from tensorflow.keras.layers import Embedding
from numpy import unique

# Count the unique number of teams
n_teams = ____(games_season[____]).shape[0]

# Create an embedding layer
team_lookup = Embedding(input_dim=n_teams,
                        output_dim=____,
                        input_length=____,
                        name='Team-Strength')
Kodu Düzenle ve Çalıştır