متقدم
البحث فيالملخصات
طريقة البحث
  • الكلمات تجد عناوين الدروس والنص والكود. صفِّ حسب النوع (أدلة، دورات، برامج، كتب) أو ابقَ في هذا الكتاب.
  • book:rhcsa و ch:8 يضيّقان البحث؛ ‎#code يجد الكلمة داخل أوامر الدروس فقط.
  • "كلمتان" تجد العبارة بالضبط.
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث
جرّب:

الدورة 3الاسم في الدورة: Deep Learning with Keras and TensorFlow

Deep Learning with Keras and TensorFlow

Course 3 of 13 in the IBM AI Engineering certificate. Advanced Keras: the functional API and custom layers.

Course page: Coursera

  • 11 الدروس
  • 0 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

3.1

What the course covers

Advanced Keras: the functional API and custom layers.

  • Advanced CNNs: data augmentation, transfer learning and transpose convolution.
  • Transformers for text and for sequential data.
  • Unsupervised models: autoencoders, diffusion models and GANs.
  • Custom training loops and hyperparameter tuning.
  • Reinforcement learning: Q-learning and deep Q-networks.
ModuleMain focus
Module 1 · about 3 hoursAdvanced Keras Functionalities: functional API, custom layers and models, TensorFlow 2.x
Module 2 · about 4 hoursAdvanced CNNs in Keras: augmentation, transfer learning, pretrained models, transpose convolution
Module 3 · about 3 hoursTransformers in Keras: attention, sequential data, time series, text generation
Module 4 · about 4 hoursUnsupervised Learning and Generative Models: autoencoders, diffusion models, GANs
Module 5 · about 3 hoursAdvanced Keras Techniques: custom training loops, callbacks, Keras Tuner
Module 6 · about 3 hoursIntroduction to Reinforcement Learning with Keras: Q-learning and DQNs
Module 7 · about 3 hoursFinal Project Submission: advanced regression model, final assessment

3.2

Module 1: Advanced Keras Functionalities

Advanced Keras Functionalities: functional API, custom layers and models, TensorFlow 2.x.

  • The functional API connects layers like functions. It allows many inputs, many outputs and shared layers.
  • A custom layer is a class that extends Layer. Put the main logic in call().
  • Keras is part of TensorFlow 2.x (tf.keras). Layers, losses and optimizers are the same.
  • Sequential only stacks layers in a line. The functional API gives more control.

3.3

Module 2: Advanced CNNs in Keras

Advanced CNNs in Keras: augmentation, transfer learning, pretrained models, transpose convolution.

  • Data augmentation makes changed copies of images: flip, rotate, zoom and shift. It helps reduce overfitting.
  • Transfer learning: freeze the pretrained base, then train a new head on your data.
  • Fine-tuning: unfreeze some top layers and train with a small learning rate.
  • Pretrained models such as VGG16, ResNet50 and MobileNet are in tf.keras.applications.
  • Transpose convolution (Conv2DTranspose) upsamples a small image to a bigger one.

3.4

Module 3: Transformers in Keras

Transformers in Keras: attention, sequential data, time series, text generation.

  • A transformer uses self-attention to weigh all parts of the input.
  • Multi-head attention runs several attention heads in parallel.
  • Positional encoding tells the model the order of the tokens.
  • A transformer block has attention, a feed-forward network, layer norm and skip connections.
  • For text generation, the model predicts the next token again and again. Transformers also work on time series.

3.5

Module 4: Unsupervised Learning and Generative Models in Keras

Unsupervised Learning and Generative Models: autoencoders, diffusion models, GANs.

  • Unsupervised learning finds patterns in data when there are no labels.
  • An autoencoder has an encoder, a small bottleneck and a decoder. It learns to rebuild the input.
  • Diffusion models add noise to data, then learn to remove the noise step by step.
  • A GAN has a generator that makes fake data and a discriminator that tries to tell fake from real. GAN training can be unstable.

3.6

Module 5: Advanced Keras Techniques

Advanced Keras Techniques: custom training loops, callbacks, Keras Tuner.

  • A custom training loop gives full control: read the batch, compute the loss, apply the gradients.
  • tf.GradientTape records the operations, so you can compute the gradients.
  • Callbacks run during training: EarlyStopping, ModelCheckpoint and LearningRateScheduler.
  • Keras Tuner searches for good hyperparameters with RandomSearch, Hyperband or BayesianOptimization.

3.7

Module 6: Introduction to Reinforcement Learning with Keras

Introduction to Reinforcement Learning with Keras: Q-learning and DQNs.

  • Reinforcement learning trains an agent that acts in an environment and gets a reward. The policy is the rule for choosing actions.
  • Q-learning learns the value of each state-action pair.
  • A DQN uses a neural network to estimate Q values. This works for large state spaces.
  • A replay buffer stores past experiences. Training samples them again to break correlation.
  • A target network is a slow copy of the Q network. It makes the learning target more stable.
  • Epsilon-greedy: take a random action with probability epsilon (explore), else take the best action (exploit).

3.8

Module 7: Final Project Submission

Final Project Submission: advanced regression model, final assessment.

  • The final project builds an advanced regression model in Keras: load, clean, scale, build, train and test.
  • Save the model with model.save(). Report the metrics and explain your choices.

3.9

Check yourself

Answer each question first, then open it to check the answer.

1What does the Keras functional API let you do? a) Connect layers like functions and build many-input or many-output models · b) Train a model in one line only · c) Load a saved model only · d) Work with images only

a) Connect layers like functions and build many-input or many-output models. Layers are called like functions.

2In a custom Keras layer, where does the main layer logic go? a) In the call() method · b) In fit() · c) In compile() · d) In predict()

a) In the call() method. call() holds the forward step of the layer.

3What is data augmentation? a) Making more training images by flipping, rotating or zooming them · b) Deleting images from the training set · c) Changing all labels to random values · d) Compressing the model file

a) Making more training images by flipping, rotating or zooming them. Augmentation makes changed copies of the images.

4In transfer learning, what do you usually do with the pretrained base first? a) Train all its weights from zero · b) Freeze its weights and train a new head · c) Delete all its layers · d) Set its input size to zero

b) Freeze its weights and train a new head. Freeze the base, then train the new head.

5What does self-attention do in a transformer? a) It weighs the parts of the input that matter for each output · b) It stores the data on disk · c) It removes all the weights · d) It makes the model smaller

a) It weighs the parts of the input that matter for each output. Attention gives each input part a weight.

6What does an autoencoder try to do? a) Rebuild its input after passing it through a small bottleneck · b) Predict a house price from a table · c) Sort the rows of a CSV file · d) Count the words in a text

a) Rebuild its input after passing it through a small bottleneck. The bottleneck forces a compact representation.

7In a GAN, what are the two networks? a) Encoder and decoder · b) Generator and discriminator · c) Teacher and student · d) Input and output

b) Generator and discriminator. The generator makes fakes. The discriminator checks them.

8What does tf.GradientTape do? a) It records operations so you can compute gradients · b) It saves a CSV file · c) It draws a chart · d) It splits the data

a) It records operations so you can compute gradients. GradientTape records the forward pass for the backward step.

9What is Keras Tuner used for? a) Finding good hyperparameters for a model · b) Hosting a website · c) Cleaning the labels · d) Building a database

a) Finding good hyperparameters for a model. It tries many hyperparameter values.

10What is the job of the replay buffer in a DQN? a) It stores past experiences so the network can learn from them again · b) It saves only the model weights · c) It deletes bad actions from the environment · d) It draws the reward curve

a) It stores past experiences so the network can learn from them again. Replay breaks the correlation between nearby samples.

3.10

Study and exam tips

Know the why of each tool, not only the name.

  • Remember the order: freeze the base, add a head, then fine-tune with a small learning rate.
  • Match each generative model to its parts: autoencoder, GAN, diffusion.
  • In reinforcement learning, learn the words: agent, environment, reward, policy, epsilon.
  • For the final project, report the metrics and explain your choices.