简体   繁体   English

深度学习,如何代表零到很多项?

[英]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 但是,如果您需要具体的框架来回答这个问题,我会选择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. 如果送给一个孩子的礼物取决于送给其他孩子的礼物,则可以使用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. 如果礼物取决于所有其他儿童礼物,则可以尝试bi-LSTM。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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