1
$\begingroup$

I am working on a project that has the aim of generating "recipes" which are the summation of "ingredients" (1-dimentional length N tensors, where each index is a value that represents how much of a characteristic this ingredient has).

My current plan for each recipe is to have a 2d tensor made from the 1d ingredients:

[[ ingredient 1 ],

[ ingredient 2 ],

   ...

[ ingredient K ]]

An issue is that each recipe has a variable number of ingredients. My planned solution was to add empty ingredients to fill out the length of the recipes so they are all the same, but feedback on this would be appreciated.

The goal is to have the generator learn which combinations of characteristics go together and in what amounts. The thing is that the order of these ingredients does not matter. If I did not need the ingredients themselves I would be training this on the summation of all ingredients per recipe.

What is the best way to approach this? My first instinct is to randomize the order of the ingredients and train with every possible combination, but I do not know enough of how GANs function to tell if this would be a bad approach.

Any feedback/links to related work would be appreciated, thanks

$\endgroup$
3
  • $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Commented Sep 1, 2021 at 19:53
  • $\begingroup$ Why not do something similar to dummy encoding, where the universe of possible ingredients is enumerated as a vector and then you fill in each element with the amount of the ingredient (or zero, which is also an amount)? $\endgroup$
    – Sycorax
    Commented Sep 1, 2021 at 22:04
  • $\begingroup$ My reasoning for this approach was that ideally the GAN would be able to make connections with the attributes within each ingredient, though the dummy encoding approach could possibly end up with the same result just by how the ingredients are combined. I will probably end up going with that if other options do not seem to be working. $\endgroup$ Commented Sep 1, 2021 at 22:59

1 Answer 1

0
$\begingroup$

Variable length with permutation invariance for generative networks is very hard and no method that I know of currently tackles both at the same time with good success rate.

If you only need variable length outputs RNNs are used for the time dimension and CNNs are used for the spatial dimension.

However for your case, is there anything preventing you from just outputting a single very large vector, with each index corresponding to one ingredient? That would take care of the permutation problem.

For example, if you have 32 ingredients with 3 attributes each, you could output 3 vectors of size 32. Missing ingredients can be set as 0 in all attributes.

$\endgroup$
1
  • $\begingroup$ Thank you for the feedback. That is an interesting idea. Do you think that would perform better than a recipe with the maximum number of ingredient vectors, but the "slots" that are not involved are all empty? Something like this? [[ att0, att1, att2 ], [ att0, att1, att2 ], [ 0, 0, , ], [ 0, 0, , ]]. I guess your suggestion method would address the ordering of ingredients issue better. $\endgroup$ Commented Sep 1, 2021 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.