Hands on Machine Learning with Scikit-Learn, Keras & TensorFlow\TEST
BANK EXAM 2025-2026 \NEWEST VERSION WITH UPDATED
QUESTIONS AND CORRECT DETAILED ANSWERS \VERIFIED
100% \ALREADY GRADED A+
Lack of Data
Poor Data Quality
Can you name four of the Nonrepresnetativ
main challenges in ML? e Data
Uninformative
Features
Excessively
Simple Models
Excessively
Complex Models
If your model performs great It is overfitting the data
on the
training data but generalizes
poorly to new instances,
what is happening?
- Get More Data
What are three possible - Simplify the Model (reducing the number of
solutions to poor parameters of features to force generalization)
- Reducing Noise in the Training Data
generalization?
What is a test set, and why Used to estimate the generalization error that a model
would you want to use it? will make on new instances, before the model is
launched in production.
It is used to compare models. It makes it possible to
What is the purpose of a
validation set? select the best model and tune the hyperparameters.
1/90
,6/20/25, 7:16 PM
It is part of the training set held out.
What is the train-dev set?
When do you need it? It is used when there is a risk of mismatch between the
training data and hte data used in the validation and
test datasets.
What can go wrong if you You risk overfitting the test set, and the generalization
tune error you measure will be optimistic.
hyperparameters using the test
set?
How can we choose to make Set mask_zero=True in the embedding layer
the model
ignore all padding when that
padding is set to zero?
Any layer that supports supports_masking
masking must have
_ attribute equal to True.
When should you use masking For more complex models such as when you need to
layers and automatic mask mix Conv1D layers with recurrent layers.
propagation?
2/90
,6/20/25, 7:16 PM
The model is training on the rest of training set and
How do you use a train-dev
set? evaluated on the train-dev and validation set.
If the model is performing Likely overfitting the training set
well on the
training set but not on the
train-dev set, what is
occurring?
If the model performs well on A data mismatch between the training data and the validation +
both the test data.
training set and the train-
dev set, but not on the Improve the training data to make it look more like the validation +
test data.
validation set, then what
is
occurring?
Which linear regression SGD, GD, MGD, or BGD. The "Normal Equation" or
training algorithm can you SVD approach won't work because of computational
use if you have a training complexity grows quickly (more than quadratically) with
set with millions of the number of features.
features?
Because the cost function will have the shape of an
elongated bowl, Gradient Descent will take a long time
Suppose the features in your
to converge.
training set have very
different scales. Which
Also: regularized models may converge to a suboptimal
algorithms might suffer from
this and how? solution if the if the features are not scaled, as
regularization penalizes large weights, which causes
smaller
values to be ignored compared to features with larger values.
Suppose the features in your Scale the data before training the model.
training set
have very different scales.
What can you do about the
problems this creates?
Can Gradient Descent get No, because the cost function is convex.
stick in a local minimum
when training a Logistic
Regression model?
3/90
, 6/20/25, 7:16 PM
If the optimization problem is convex, and the learning rate is not
Do all Gradient Descent
too high, then yes.
algorithms lead to the same
model, provided you let However, if you don't reduce the learning rate, SGD and
them run long enough? MGD will never truly converge. They will bounce
around the optimum.
The learning rate might be too high and the algorithm is
Suppose you use Batch
diverging. If the training
Gradient Descent and you
error also goes up, then this is clearly the problem.
plot the validation error at
Solve by reducing the learning rate.
every epoch. If you notice
that the validation If training error is not going up, then you model is
error consistently goes up, overfitting, and you should stop training.
what is likely going on?
How can you fix this?
Is it a good idea to stop Mini- Neither SGD or MGD are guarenteed to make
batch progress at every epoch, so no. However, you can
Gradient Descent immediately
checkpoint, then stop when it hasn't improved, and us
when the validation error
the model that performed the best.
goes up?
Which Gradient Descent SGD, as it only takes one training instance at a time.
algorithm will reach the
vicinity of the optimal
solution the fastest?
Which Gradient Descent Batch Gradient Descent
algorithm will actually
converge?
How can you make other Gradually reduce the learning rate
Gradient Descent algorithms
converge?
Suppose you are using If the val error is much highter than the training error,
Polynomial you are overfitting. Reduce the polynomial degree, or
Regression. You plot the
regularize the model (perhaps by adding an l2 penalty
learning curves and you
(ridge) or an l1 penalty (lasso) to the cost function) .
notice that there is a large
gap between the training You can also increase the size of the training set.
error and the
validation error. What is
4/90