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
Fourier Features #477
Comments
|
I tried this approach and it worked, thank you. But I wonder if using such expression is the same as the approach I'd like to implement. The architecture of the network still has two-dimensional input, but my idea was to make the input 2m-dimensional. Or data is passed through the input layer and then the 2d vector is transformed into a 2m-dimensional vector? |
Yes, it works as you expected. |
Thanks for the support! |
Dear Dr. Lu,
Thanks for providing such a useful library. I found it really helpful. Currently, I have been testing one of my hypotheses (based on this work) and faced a small problem.
What I want to implement
I want to make an encoding function before network input to encode features. For that, I use such things:
I have an input vector. In my case, it is two-dimensional (x, y coordinates).
And I'd like to provide transform such that:
Using random matrix B. So, the final formula looks like that:
Speaking schematically: 2d vector with coordinates --> gamma function --> gamma fuction transform 2d vector into 2m-dimensional vector --> network input.
What I already implemented
I use a simple problem with the Poisson equation:
PDE definition:
Other important declarations:
The problem itself
Now, according to my logic, I have to declare network architecture. And to validate my hypothesis the input layer has to have a width of 2m (for example, consider m = 10). Then for network I have such code:
After that I read here that Fourier features can be implemented using
apply_feature_transform()
function. Therefore, I implemented such code:After that
model.compile("adam", lr=0.001, metrics=["l2 relative error"])
works fine and outputs:But after that, I run this part of the code:
And face an error that
ValueError: Cannot feed value of shape (1270, 2) for Tensor Placeholder_35:0, which has shape (None, 20)
.As I can interpret it, the shape of the input vector is incorrect. As expected it is 2d vector, but the network waits for a 20d vector. I expected that this dimensional crisis can be solved by
apply_feature_transform()
function, but it seems that something is wrong.Question
Is it even possible by using today's tools of deepxde to implement such an idea? And if yes, may you advise some way of doing it? I have been trying to solve it myself for a couple of days but seem to be completely stuck.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: