1. Home
  2. Data Science
  3. TensorFlow
  4. For multi-class labels given as integers (0, 1, 2…), which…

Added 2 Nov 2026

For multi-class labels given as integers (0, 1, 2…), which loss is appropriate?

  1. categorical_crossentropy
  2. sparse_categorical_crossentropy Correct answer
  3. kullback_leibler_divergence
  4. binary_crossentropy

Correct answer

B. sparse_categorical_crossentropy

18 views

MCQSEXAM

Explanation

Sparse categorical cross-entropy accepts integer class IDs directly. categorical_crossentropy expects one-hot vectors, binary_crossentropy is for two-class or multi-label output, and KL divergence compares probability distributions.

Reference

Asked in: Data Science Interviews, AI Engineer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More TensorFlow MCQs

Practise all TensorFlow MCQs

Similar MCQs