简体   繁体   中英

Deep learning, how to represent zero to many items?

Suppose I'd like to predict what presents a parent wants to buy for their kids, and I have kid's age.

Problem is that some have just 1 kid, and some have more.

How do you model your input (for the kids) for your network when the number of kids vary?

I guess the question is independent of what framework I use.
But if you need concrete framework to answer the question, I'd go with tf.keras

If gift to one kid is independent of gifts to other kids, then we can model it as a model which takes in as input the age of a kid(one kid) and predicts the best gift (for that kid) from predefined classes of gifts. Along with the kids age you can add custom features, like say what color the kid likes, height weight etc.

在此处输入图片说明

In the case if the gift to one kid depends on the gift given to other kids, you can model it as a sequence to sequence mapping using LSTM. They are good in handling variable length inputs. You can order the kids on some criteria like say smallest kid first. You can try bi-LSTM if the gift depends on all other kids gifts.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM