New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Google Professional Data Engineer Exam - Topic 2 Question 117 Discussion

Actual exam question for Google's Professional Data Engineer exam
Question #: 117
Topic #: 2
[All Professional Data Engineer Questions]

How can you get a neural network to learn about relationships between categories in a categorical feature?

Show Suggested Answer Hide Answer
Suggested Answer: D

There are two problems with one-hot encoding. First, it has high dimensionality, meaning that instead of having just one value, like a continuous feature, it has many values, or dimensions. This makes computation more time-consuming, especially if a feature has a very large number of categories. The second problem is that it doesn't encode any relationships between the categories. They are completely independent from each other, so the network has no way of knowing which ones are similar to each other.

Both of these problems can be solved by representing a categorical feature with an embedding

column. The idea is that each category has a smaller vector with, let's say, 5 values in it. But unlike a one-hot vector, the values are not usually 0. The values are weights, similar to the weights that are used for basic features in a neural network. The difference is that each category has a set of weights (5 of them in this case).

You can think of each value in the embedding vector as a feature of the category. So, if two categories are very similar to each other, then their embedding vectors should be very similar too.


Contribute your Thoughts:

0/2000 characters
Kandis
5 days ago
There was a practice question about using embeddings versus one-hot encoding, and I think embeddings might be better for capturing similarities between categories.
upvoted 0 times
...
Tasia
10 days ago
I remember something about embedding layers being useful for capturing relationships in categorical data. It seems like a good approach, but I need to double-check the details.
upvoted 0 times
...
Clay
15 days ago
I think we can use techniques like one-hot encoding to represent categorical features, but I'm not entirely sure how that helps the network learn relationships.
upvoted 0 times
...
Brinda
20 days ago
Oof, this is a tricky one. I'm not super familiar with the best way to handle categorical features in neural nets. I'll have to review my notes and see if I can come up with a solid strategy.
upvoted 0 times
...
Roy
25 days ago
Okay, for this I'd probably start by one-hot encoding the categorical feature. Then I could try feeding that into an embedding layer to see if that helps the model pick up on the relationships. Seems worth a shot!
upvoted 0 times
...
Shenika
1 month ago
Hmm, I'm not totally sure about this one. I'd need to think through the different approaches and how they might work. Maybe I could look at some examples online to get some ideas.
upvoted 0 times
...
Karma
1 month ago
I think I could use some kind of embedding layer to capture the relationships between the categories. That might help the model learn the patterns.
upvoted 0 times
...

Save Cancel