Lightning AI Studios: Never set up a local environment again →

Log in or create a free Lightning.ai account to track your progress and access additional course materials  

Unit 1 Exercises

Exercise 1: Add early-stopping to make the Perceptron more efficient.

In its original implementation, the perceptron completes the number of epochs specified via the epochs argument:

def train(model, all_x, all_y, epochs):
    ...

However, this can result in executing too many unnecessarily. Modify the train function in Section 4 (4) Implementing the Perceptron such that it automatically stops when the perceptron classifies the training data perfectly.

Link to exercise notebook: https://github.com/Lightning-AI/dl-fundamentals/blob/main/unit01-ml-intro/exercises/1_early-stop/exercise_1_early-stop.ipynb

Exercise 2: Initialize the model parameters with small random numbers instead of 0’s

Modify the Perceptron class in Section 4 such that it initializes the weights and bias unit using small random numbers (detailed instructions are provided in the notebook). Then observe how it affects the training performance of the perceptron. Does it train/learn better or worse?

Link to exercise notebook: https://github.com/Lightning-AI/dl-fundamentals/blob/main/unit01-ml-intro/exercises/2_random-weights/exercise_2_random-weights.ipynb

Exercise 3: Use a learning rate for updating the weights and bias unit

Modify the Perceptron class using a so-called learning rate for updating the weights and bias unit. The learning rate is a setting for adjusting the magnitude of the weight and bias unit updates. Changing the learning rate can accelerate or slow down the learning speed of the perceptron (in terms of the number of iterations required for finding a good decision boundary).

Link to exercise notebook: https://github.com/Lightning-AI/dl-fundamentals/blob/main/unit01-ml-intro/exercises/3_learning-rate/exercise_3_learning-rate.ipynb

Log in or create a free Lightning.ai account to access:

  • Quizzes
  • Completion badges
  • Progress tracking
  • Additional downloadable content
  • Additional AI education resources
  • Notifications when new units are released
  • Free cloud computing credits
Watch Video 1

Unit 1 Exercises

Videos
Follow along in a Lightning Studio

DL Fundamentals 1: Intro to ML & DL

Sebastian
Launch Studio →
Questions or Feedback?

Join the Discussion