Deal of The Day! 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

Posted by Crista on Jan 28, 2026 at 07:56 PM

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

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.


Get Premium Professional Data Engineer Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
25 comments · newest first
TH
Thurman 3 months ago
Definitely! Neural networks can capture complex patterns.
MY
Myong 3 months ago
I feel like decision trees could help too.
JO
Johna 4 months ago
Maybe try embeddings for better relationships?
DO
Dominga 5 months ago
Use one-hot encoding for categorical features.
PA
Paris 5 months ago
I think decision trees can also work for categorical features!
KE
Keshia 5 months ago
You can also try one-hot encoding, but it might not capture nuances.
BE
Bettina 6 months ago
Wait, can embeddings really understand complex relationships?
MA
Markus 6 months ago
Totally agree, embeddings really help capture relationships!
ED
Edda 6 months ago
One way is to use embeddings for the categories.
PE
Pearlie 6 months ago
Embedding layer is the obvious choice. Unless you're still using a flip phone, that is.
AN
Angelica 6 months ago
Embedding layer is the way to go. One-hot encoding is so 2010.
JA
Jaime 6 months ago
Embedding layer for sure! That way the network can learn the relationships between the categories.
IS
Isreal 7 months ago
Hmm, I'm not sure about that. Wouldn't that just treat the categories as independent? I'd try something like an embedding layer instead.
CO
Corinne 7 months ago
I think using one-hot encoding and feeding that into the neural network would work well.
AL
Alease 7 months ago
I feel like we discussed using decision trees to understand categorical features, but I'm not clear on how that translates to neural networks.
KA
Kandis 8 months 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.
TA
Tasia 8 months 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.
CL
Clay 8 months 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.
BR
Brinda 8 months 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.
RO
Roy 8 months 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!
SH
Shenika 9 months 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.
KA
Karma 9 months 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.
FR
Freeman 3 months ago
↳ replying to Karma
True, but embeddings usually perform better with larger datasets.
DE
Derick 3 months ago
↳ replying to Karma
Have you considered using one-hot encoding too? It can work well for some models.
KI
Kirk 3 months ago
↳ replying to Karma
Embedding layers are definitely a good start! They can help with capturing similarities.
0/2000 characters

Save Cancel