nerdexam
Databricks

DATABRICKS-CERTIFIED-PROFESSIONAL-DATA-SCIENTIST · Question #107

In machine learning, feature hashing, also known as the hashing trick (by analogy to the kernel trick), is a fast and space-efficient way of vectorizing features (such as the words in a language)…

The correct answer is B. It requires the lesser memory to store the coefficients for the model. This hashed feature approach has the distinct advantage of requiring less memory and one less pass through the training data, but it can make it much harder to reverse engineer vectors to determine which original feature mapped to a vector location. This is because multiple…

Feature Engineering

Question

In machine learning, feature hashing, also known as the hashing trick (by analogy to the kernel trick), is a fast and space-efficient way of vectorizing features (such as the words in a language), i.e., turning arbitrary features into indices in a vector or matrix. It works by applying a hash function to the features and using their hash values modulo the number of features as indices directly, rather than looking the indices up in an associative array. So what is the primary reason of the hashing trick for building classifiers?

Options

  • AIt creates the smaller models
  • BIt requires the lesser memory to store the coefficients for the model
  • CIt reduces the non-significant features e.g. punctuations
  • DNoisy features are removed

How the community answered

(29 responses)
  • A
    7% (2)
  • B
    72% (21)
  • C
    17% (5)
  • D
    3% (1)

Explanation

This hashed feature approach has the distinct advantage of requiring less memory and one less pass through the training data, but it can make it much harder to reverse engineer vectors to determine which original feature mapped to a vector location. This is because multiple features may hash to the same location. With large vectors or with multiple locations per feature, this isn't a problem for accuracy but it can make it hard to understand what a classifier is doing. Models always have a coefficient per feature, which are stored in memory during model building. The hashing trick collapses a high number of features to a small number which reduces the number of coefficients and thus memory requirements. Noisy features are not removed; they are combined with other features and so still have an impact. The validity of this approach depends a lot on the nature of the features and problem domain; knowledge of the domain is important to understand whether it is applicable or will likely produce poor results. While hashing features may produce a smaller model, it will be one built from odd combinations of real-world features, and so will be harder to interpret. An additional benefit of feature hashing is that the unknown and unbounded vocabularies typical of word-like variables aren't a problem.

Topics

#feature hashing#memory efficiency#hashing trick#coefficient storage

Community Discussion

No community discussion yet for this question.

Full DATABRICKS-CERTIFIED-PROFESSIONAL-DATA-SCIENTIST Practice