Google Cloud Professional Machine Learning Engineer — Question 18

Your team needs to build a model that predicts whether images contain a driver's license, passport, or credit card. The data engineering team already built the pipeline and generated a dataset composed of 10,000 images with driver's licenses, 1,000 images with passports, and 1,000 images with credit cards. You now have to train a model with the following label map: [`˜drivers_license', `˜passport', `˜credit_card']. Which loss function should you use?

Answer options

Correct answer: D

Explanation

The correct answer is D, Sparse categorical cross-entropy, which is suitable for multi-class classification tasks where labels are provided as integers. Options A and C are not ideal for this scenario; Categorical hinge is generally used for multi-class setups but is less common than cross-entropy methods. Binary cross-entropy is designed for binary classification tasks, making it inappropriate for this multi-class problem.