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

Rckirby/getavec #6

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open

Rckirby/getavec #6

wants to merge 40 commits into from

Conversation

Re-GeorX
Copy link
Collaborator

@Re-GeorX Re-GeorX commented Dec 2, 2022

Do not merge until results from @nguyenvanhaibk92 have been added. PR open so we can start working on any fix that may be done at the same time

@Re-GeorX Re-GeorX self-assigned this Dec 2, 2022
Copy link
Owner

@rckirby rckirby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of good work here.
Generally,
i) we need to run flake8 over all the Python files for cleanup purposes (e.g. white space, commented-out code, etc)
ii) I think having so many fenics->firedrake conversions in place is not a good look for us. We should eventually support FEniCS, but how hard is it to make all of the examples work end-to-end in Firedrake, or at least encapsulate the conversion (which is only used for getting kappas, I think) inside some function that we call so that every test isn't littered with loading a bunch of fenics matrices and doing ugliness.
iii) see particular comments inline in the code.

neurons = 1000


# ! 1. Loading data by pandas
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a demo -- say in some comments why you're loading all this from pandas -- what are you doing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File was deleted

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanations have not been added yet in similar codes. Will keep open

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nguyenvanhaibk92 I think you are the best person to say why we are loading all the csv files. Can you add a few comments explaining this?

Copy link
Collaborator

@nguyenvanhaibk92 nguyenvanhaibk92 Dec 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, I generate data for training and testing (model inference) and save them to .csv files. Then, we load data from these files to train the neural network. Hence, we do not need to regenerate data again each time we run the code.

Pandas is just a convenient package to load data from .csv files.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pandas is convenient. One needs to decide whether the cost of generating the data is significant relative to the cost of training?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a quick comment to add what @nguyenvanhaibk92 explained. Shall I mark this as resolved?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generating data time takes a few minutes, which is not much compared to training time.

The best option is to provide a python file (I do not have a "good" one for this problem, which uses a random seed that allows the users to be able to reproduce results. However, in the problem setting (in the proposal, or paper later), we have an explanation of what data (e.g. z coefficients, eigenvectors, eigenvalues...) are. I think it's fine at the moment if we do not have one.

It will take time to create one, we will have it in the next update.

ml_templates/model_inference.py Outdated Show resolved Hide resolved
ml_templates/torchfire.py Outdated Show resolved Hide resolved
ml_templates/torchfire_tnet_inverse.py Outdated Show resolved Hide resolved
ml_templates/torchfire_tnet_inverse.py Outdated Show resolved Hide resolved
demos/tnet_heat_equation/tnet_heat_eq.py Outdated Show resolved Hide resolved
neurons = 1000


# STEP 1. Loading data from .csv files
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment as to what you're doing here (is this where the FEniCS-converted data comes from so that FEniCS is hidden from view?

Copy link
Collaborator

@nguyenvanhaibk92 nguyenvanhaibk92 Jan 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kappa samples are drawn from KL expansion formula. Then, the solution state is obtained by Firedrake solver. There is no Fenics.

neurons = 1000


# STEP 1. Loading data from .csv files
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, a comment is helpful, here and later in CSV?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding more comments to all files nFEM and TNet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants