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 simple working example of basic TCN / MomentNetwork structure #58

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

Conversation

JLDC
Copy link

@JLDC JLDC commented Jul 10, 2023

Proposed changes

Add a simple example of how a neural network (temporal convolutional network) could be used to construct the moments of a given underlying model.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the CONTRIBUTING doc
  • I am making a pull request against the main branch (left side). Also you should start your branch off our main.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works

Further comments

This is really a minimal working example somewhat outside of the package structure. It should be integrated in the package structure and the PR is being created as discussed with @AldoGl. He will make changes to this PR before integrating it.

@AldoGl
Copy link
Contributor

AldoGl commented Jul 10, 2023

Thank you Jonathan, great work! We'll try and integrate your algorithm soon :)

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2023

Codecov Report

Merging #58 (35d2742) into main (152aa9b) will not change coverage.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #58   +/-   ##
=======================================
  Coverage   91.36%   91.36%           
=======================================
  Files          42       42           
  Lines        1737     1737           
=======================================
  Hits         1587     1587           
  Misses        150      150           

…with existing classes, add example notebook, fixed typing and some linting
@AldoGl
Copy link
Contributor

AldoGl commented Jul 26, 2023

Today I worked on the code and did the following:

  • I moved modules into appropriate folders (loss_functions, test, example)
  • I better integrated the code with existing classes (for instance, now the sampler used in the network is a Black-it sampler, and the parameter ranges are specified via a SearchSpace object)
  • I added an example notebook (where i first compute the optimal moment function, and then I use it within a method of moments calibration)
  • I fixed typing and linting error as much as possible
  • I added @JLDC as an author

There is still some work to do, primarily:

  • write the rest of the docstrings
  • fix all linting errors
  • write a test (I added a dummy test, we can start from there)
  • consider what should be done to extend the code to multiple moments while preserving existing abstractions within the method of moments loss function

@AldoGl
Copy link
Contributor

AldoGl commented Jul 26, 2023

@JLDC, could you give access to your fork also to @marcofavoritobi? (no hurry)

@JLDC
Copy link
Author

JLDC commented Jul 28, 2023

@JLDC, could you give access to your fork also to @marcofavoritobi? (no hurry)

He should already have access. Any maintainer is allowed to edit this pull request. Let me know if I am mistaken and I need to undertake something else.

Comment on lines +358 to +404
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.6542314"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Y.mean()"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.19000853598117828"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Y.std()*2 "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the last cells can be removed, right? They look like "debugging cells"

MSE_LOSS = nn.MSELoss()


# TODO: Some issues with the parameters imho, the optimizer as a Callback is not
Copy link
Contributor

Choose a reason for hiding this comment

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

"cell_type": "markdown",
"metadata": {},
"source": [
"In this tutorial we show how to use the algorithm of Chassot et al. (**TITLE**) to learn optimal moments using neural networks. "
Copy link
Contributor

Choose a reason for hiding this comment

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

can we replace TITLE with the actual paper title?

This module contains a Moment Network implementation.

- Chassot, J. (2023).
Paper name
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add paper title here? And the other authors?

Copy link
Author

Choose a reason for hiding this comment

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

The title is still somewhat a working title, we might change it but if that is the case I will open a pull request. In the meanwhile, the title is "Constructing Efficient Simulated Moments Using Temporal Convolutional Networks", by Jonathan Chassot and Michael Creel. Link: https://www.jldc.ch/uploads/2023_chassot_creel.pdf

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.

4 participants