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?
Click on the arrows to vote for the correct answer
A. B. C. D.D.
se sparse_categorical_crossentropy.
Examples for above 3-class classification problem: [1] , [2], [3] Reference: https://stats.stackexchange.com/questions/326065/cross-entropy-vs-sparse-cross-entropy-when-to-use-one-over-the-other.
Based on the label map provided, there are three distinct classes, so the appropriate loss function should be able to handle multi-class classification.
Option A, Categorical hinge loss, is often used in multiclass SVMs, which aims to maximize the margin between the decision boundary and the samples. However, this loss function is not suitable for neural networks, as it requires that the output of the model be real-valued.
Option B, Binary cross-entropy loss, is a loss function used for binary classification problems, where there are only two classes. It is not appropriate for this problem because there are three classes.
Option C, Categorical cross-entropy loss, is a popular choice for multi-class classification problems. It measures the difference between the predicted probability distribution and the true probability distribution. This loss function would be appropriate for this problem.
Option D, Sparse categorical cross-entropy loss, is similar to categorical cross-entropy, but it is used when the true labels are integers rather than one-hot encoded. This loss function is appropriate when there are many classes and the number of classes is much larger than the number of samples, but in this case, the number of classes is small, so categorical cross-entropy would be a better choice.
Therefore, the appropriate loss function for this problem would be Categorical cross-entropy.