Solution to Exercise 1 of Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition
Tags: Machine Learning Systems, Supervised Learning, Machine Learning, Unsupervised Learning, Algorithms

1. How would you define Machine Learning?

Machine Learning is the science (and art) of programming computers so they can learn from data.

2. Can you name four types of problems where it shines?

• Problems for which existing solutions require a lot of hand-tuning or long lists of rules: one Machine Learning algorithm can often simplify code and perform better.

• Complex problems for which there is no good solution at all using a traditional approach: the best Machine Learning techniques can find a solution.

• Fluctuating environments: a Machine Learning system can adapt to new data.

• Getting insights about complex problems and large amounts of data.

3. What is a labeled training set?

A labelled training set is the training data which includes the desired solutions/output, called labels. It is fed to the algorithm for supervised learning.

4. What are the two most common supervised tasks?

The two most common supervised tasks are Classification and Regression.

5. Can you name four common unsupervised tasks?

• Clustering

• Anomaly detection and novelty detection

• Visualization and dimensionality reduction

• Association rule learning

6. What type of Machine Learning algorithm would you use to allow a robot to walk in various unknown terrains?

Reinforcement Learning is the Machine Learning algorithm that should be used which will allow the robot to observe the environment, select and perform actions and decide the best strategy (policy).

7. What type of algorithm would you use to segment your customers into multiple groups?

Clustering is used for customer segmentation.

8. Would you frame the problem of spam detection as a supervised learning problem or an unsupervised learning problem?

Spam detection problem is a supervised learning problem because it uses labeled training set for learning.

9. What is an online learning system?

Online learning system is a Machine Learning system that trains the system incrementally by feeding it data instances sequentially, either individually or by small groups called mini-batches so that the system can learn about new data on the fly, as it arrives.

10. What is out-of-core learning?

Online learning algorithms that used to train systems incrementally on huge datasets that cannot fit in one machine’s main memory, is called out-of-core learning. This algorithm loads part of the data, runs a training step on that data and repeats the process until it has run on all of the data.

11. What type of learning algorithm relies on a similarity measure to make predictions?

Instance-based learning

12. What is the difference between a model parameter and a learning algorithm’s hyperparameter?

Model parameter is a parameter of the function/model which is calculated while training the process so that we get the best fit model.

Whereas a hyperparameter is a parameter of a learning algorithm and not of the model. It is not affected by the learning algorithm itself rather it must be set prior to training and remains constant during training.

13. What do model-based learning algorithms search for? What is the most common strategy they use to succeed? How do they make predictions?

Model-based learning algorithms search for the best model that can be used for prediction purposes.

The strategy they use to succeed :

Study the data Model selection Model training and finding model parameters that minimize a cost function to obtain the best fit model. Apply the model to make predictions on new cases.

When input data is passed to the model and based on this and the model parameters the output is predicted.

14. Can you name four of the main challenges in Machine Learning?

• Insufficient Quantity of Training Data

• Nonrepresentative Training Data

• Poor-Quality Data

• Irrelevant Features

15. If your model performs great on the training data but generalizes poorly to new instances, what is happening? Can you name three possible solutions?

If your model performs great on the training data but generalizes poorly to new instances, it means that the model is too complex relative to the amount and noisiness of the training data i.e. the model is overfitting the training data.

The three possible solutions are :

• To simplify the model by selecting one with fewer parameters (e.g., a linear model rather than a high-degree polynomial model), by reducing the number of attributes in the training data or by constraining the model.

• To gather more training data

• To reduce the noise in the training data (e.g., fix data errors and remove outliers)

16. What is a test set and why would you want to use it?

Test set is the data on which the trained model is tested or evaluated. By evaluating the model on test set we get an estimate of the error rate on new cases also known as generalization error.

17. What is the purpose of a validation set?

The purpose of a validation set is to hold out a part of the training set to evaluate several candidate models and select the best model in the end.

18. What can go wrong if you tune hyperparameters using the test set?

By tuning hyperparameters using the test set we adapted the model and hyperparameters to produce the best model for that particular set. This means that the model is unlikely to perform as well on new data.

19. What is repeated cross-validation and why would you prefer it to using a single validation set?

Repeated cross-validation is evaluating each model on many small validation sets. Each model is evaluated once per validation set after being trained on the rest of the data. Repeated cross-validation is preferred over using a single validation set because by averaging out all the evaluations of a model, we can get a much more accurate measure of its performance.

Reference :

Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition, by Aurélien Géron, Released September 2019