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

n3fit prepro initialisation #2249

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

comane
Copy link
Member

@comane comane commented Dec 13, 2024

This pull request introduces changes to the n3fit package for better initializer handling.The most important changes include adding a new initializer and modifying the weight generation logic

Initializers update:

  • n3fit/src/n3fit/backends/keras_backend/MetaLayer.py: Added RandomNormal to the list of available initializers. ([n3fit/src/n3fit/backends/keras_backend/MetaLayer.pyL11-R19](https://github.com/NNPDF/nnpdf/pull/2249/files#diff-b1e9997427e416cda90e812413c31a8c9c0748eafea0276fc297c9a1e0f6e04eL11-R19))

Weight generation logic improvement:

  • n3fit/src/n3fit/layers/preprocessing.py: Updated the generate_weight method to use a dictionary for initializer parameters and apply constraints only if the initializer is random_uniform. ([n3fit/src/n3fit/layers/preprocessing.pyL79-R87](https://github.com/NNPDF/nnpdf/pull/2249/files#diff-29a4fb3f4aba49242bccaf2c84b6c891a276e329b2ef1d7b8c20575ce83e0f88L79-R87))

Note

Based on the introduced changes the flav_info dict in the runcard would change to something like:

flav_info: [
    {
        "fl": "sng",
        "trainable": False,
        "smallx": {ini_name: "random_normal", mean: 1, stddev: 0.001}, #minval=1.099, maxval=1.109}, #[1.099, 1.109],
        "largex": {ini_name: "random_uniform", minval: 2.197, maxval: 2.397}, #[2.197, 2.397],
    },

....

This would however allow for the use of different initialisations

@RoyStegeman
Copy link
Member

Somehow I think this has been done, or at least thought of before, but I can't find any results or recall why it's not implemented. What is the reason you want to try this?

Using dict logic if the names of parameters may differ is fine for me.

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.

2 participants