0
0
PyTorchml~5 mins

Feature extraction strategy in PyTorch - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a feature extraction strategy in machine learning?
It is a method to transform raw data into useful information (features) that a model can learn from more easily.
Click to reveal answer
intermediate
Why do we freeze layers in a pretrained model during feature extraction?
Freezing layers means we do not update their weights during training. This keeps the learned features intact and reduces training time.
Click to reveal answer
beginner
In PyTorch, how do you freeze the parameters of a pretrained model?
You set each parameter's requires_grad attribute to False, like: <br>for param in model.parameters():<br>   param.requires_grad = False
Click to reveal answer
intermediate
What is the difference between feature extraction and fine-tuning?
Feature extraction uses pretrained model layers as fixed feature detectors. Fine-tuning updates some or all pretrained layers to better fit new data.
Click to reveal answer
intermediate
How can you replace the final layer of a pretrained model in PyTorch for feature extraction?
You assign a new layer to the model's classifier or fc attribute, for example:<br>model.fc = nn.Linear(in_features, num_classes)
Click to reveal answer
What does freezing layers in a pretrained model do?
ADeletes the layers from the model
BPrevents their weights from updating during training
CAdds new layers to the model
DIncreases the learning rate for those layers
Which PyTorch attribute controls if a parameter is trainable?
Arequires_grad
Btrainable
Cgrad_enabled
Dupdate_weights
What is the main goal of feature extraction?
ATo increase the size of the dataset
BTo train a model from scratch
CTo use learned features from a pretrained model to help a new task
DTo remove irrelevant data points
When replacing the final layer in a pretrained model, what must you adjust?
AThe optimizer type
BThe input image size
CThe learning rate only
DThe number of output features to match your task classes
Which of these is NOT a benefit of feature extraction?
AAlways achieves perfect accuracy
BRequires less data
CFaster training time
DUses pretrained knowledge
Explain how to perform feature extraction using a pretrained model in PyTorch.
Think about which parts of the model you keep fixed and which parts you change.
You got /4 concepts.
    Describe the difference between feature extraction and fine-tuning in transfer learning.
    Consider how much of the pretrained model you allow to learn.
    You got /4 concepts.