Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add permutational layer to LSTM #2

Open
Takusei opened this issue May 2, 2019 · 4 comments
Open

Add permutational layer to LSTM #2

Takusei opened this issue May 2, 2019 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@Takusei
Copy link

Takusei commented May 2, 2019

Dear @off99555

I am a student new to this problem.

I'm trying to build LSTM with input feature permutation invariant, for example, the feature is a set of position, how can I use this module to deal with LSTM?

Could you help me with this?

Best regards

@offchan42
Copy link
Owner

You mean you observe a bunch of points over time?

I suggest you clone the repo and try running the permutational_layer.py. There is an example at the bottom of the file. If you try playing with the code, printing the shape, or any info of the model as you add an extra layer, you will get it faster.

After you understand how it works, I suggest you use PermutationalModule function to create a model to encode your input. Then you feed the encoding to your LSTM layers.

@Takusei
Copy link
Author

Takusei commented May 9, 2019

Thanks for your quick replay, and apology for my delay.

OK, I understand the way this code works, I suppose that it’s an encoder for the input sets.
I noticed that the input shape of data in PermutationalModule() should be the same length, for example:

PermutationalModule((4,), 3, [repeat_layers(Dense, [2, 4]), repeat_layers(Dense, [8, 16])],], last_layer_pooling=maximum)
the input data should have 3 sets, and each sets have 4 features.

I’m wonder that can this model be modified to input data with variable sets numbers? Such as , not 3 sets but input 2 sets sometimes? Could this be possible?

Thanks

@offchan42
Copy link
Owner

First of all, let define what you mean by set so that we are on the same page.
My set means a collection of objects. And each object has some features.
In the above code that you mentioned, it can be interpreted as a set of 3 points, each point having 4 features. Each feature is simply a float e.g. positionX, positionY, velocityX, velocityY.

So it means that there is only one set, not many sets.

I think that you might mean 3 objects, not 3 sets. Am I right?

@offchan42
Copy link
Owner

offchan42 commented May 9, 2019

Also varying the number of objects is not possible. What you can do is to send features of 0 in the place of an object that is missing. E.g. if you have 2 objects, you can send 0,0,0,0 as features of the 3rd object.
This will still work fine.

@offchan42 offchan42 self-assigned this May 9, 2019
@offchan42 offchan42 added the question Further information is requested label May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants