nerdexam
Google

PROFESSIONAL-DATA-ENGINEER · Question #79

Which of these are examples of a value in a sparse vector? (Select 2 answers.)

The correct answer is C. [0, 1] D. [1, 0, 0, 0, 0, 0, 0]. Explanation/Reference: Categorical features in linear models are typically translated into a sparse vector in which each possible value has a corresponding index or id. For example, if there are only three possible eye colors you can represent 'eye_color' as a length 3 vector: 'b

Submitted by layla.eg· Mar 30, 2026Operationalizing machine learning models

Question

Which of these are examples of a value in a sparse vector? (Select 2 answers.)

Options

  • A[0, 5, 0, 0, 0, 0]
  • B[0, 0, 0, 1, 0, 0, 1]
  • C[0, 1]
  • D[1, 0, 0, 0, 0, 0, 0]

How the community answered

(32 responses)
  • A
    6% (2)
  • B
    6% (2)
  • C
    88% (28)

Explanation

Explanation/Reference: Categorical features in linear models are typically translated into a sparse vector in which each possible value has a corresponding index or id. For example, if there are only three possible eye colors you can represent 'eye_color' as a length 3 vector: 'brown' would become [1, 0, 0], 'blue' would become [0, 1, 0] and 'green' would become [0, 0, 1]. These vectors are called "sparse" because they may be very long, with many zeros, when the set of possible values is very large (such as all English words). [0, 0, 0, 1, 0, 0, 1] is not a sparse vector because it has two 1s in it. A sparse vector contains only a single 1. [0, 5, 0, 0, 0, 0] is not a sparse vector because it has a 5 in it. Sparse vectors only contain 0s and 1s.

Topics

#sparse vectors#feature representation#vector encoding

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-DATA-ENGINEER Practice