Skip to content

Saving new python pseudodata during fit#1333

Merged
siranipour merged 4 commits into
masterfrom
savepseudodata
Sep 1, 2021
Merged

Saving new python pseudodata during fit#1333
siranipour merged 4 commits into
masterfrom
savepseudodata

Conversation

@siranipour
Copy link
Copy Markdown
Contributor

As mentioned in #1328 (comment), the current fitting::savepseudodata flag doesn't save the python make_replica, but rather the C++ make_replica.

This blocks #1328, because I need to create a new test fit for the tests to pass there.

@Zaharid, is there anyway to change the name of the file that @table uses? Currently it's not within keeping of the convention of training.dat and validation.dat so

def read_fit_pseudodata(fitcontext, context_index):

doesn't work with new style fits.

@Zaharid
Copy link
Copy Markdown
Contributor

Zaharid commented Jul 19, 2021

@siranipour Sorry I am a bit at loss: could you describe a bit more what it does and what should it do?

@siranipour
Copy link
Copy Markdown
Contributor Author

Previously if you wanted to save the fit pseudodata, you would have fitting::savepseudodata: true which would append the following action

def pseudodata_table(replicas_exps_pseudodata, replicas, experiments_index):

to the N3FIT_DEFAULT_ACTIONS.

But this used the C++ make_replica, which is now no longer valid seeing as how we changed it to use the python make_replica recently. This PR addresses that issue by adding the two new functions training_pseudodata and validation_pseudodata to the list of actions, which in turn call the new python make_replica.

If you set the flag to true and run n3fit <runcard.yml> 1, you can see in nnfit/replica_1 there will be datacuts_theory_fitting_training.dat and datacuts_theory_fitting_validation.dat files which save the training and validation data for replica 1.

I was wondering if there was anyway to change the name of the saved .dat files because currently the read_fit_pseudodata function, which reads in the saved pseudodata (i.e the reverse of this PR), expects them to be called training.dat and validation.dat.

@Zaharid
Copy link
Copy Markdown
Contributor

Zaharid commented Jul 19, 2021

Right I think one can add a parameter to override the path, but do we insist on keeping the old behaviour?

@siranipour
Copy link
Copy Markdown
Contributor Author

I'm not overly insistent on keeping the old behaviour, I guess it would be useful for backwards compatibility since I know @RosalynLP for example has used this functionality in the past. It's more so that I'm not the biggest fan of datacuts_theory_fitting_training.dat being the file name.

@RosalynLP
Copy link
Copy Markdown
Contributor

@siranipour I've used the functionality but I might be the only one! In any case I won't be using it any more because I'm going to leave very soon. So don't keep it just because of me 😄 .

@siranipour siranipour changed the title Saving new python pseudodata Saving new python pseudodata during fit Jul 21, 2021
Comment thread n3fit/src/n3fit/scripts/n3fit_exec.py Outdated
@Zaharid
Copy link
Copy Markdown
Contributor

Zaharid commented Jul 28, 2021

Superficially this looks good to me. @scarlehoff would you mind merging this?

@scarlehoff
Copy link
Copy Markdown
Member

If you set the flag to true and run n3fit <runcard.yml> 1

Sorry, which flag? If it is a runcard flag, could it be used to the Basic Runcard with an explanation (and to the docs somewhere, probably here https://docs.nnpdf.science/n3fit/runcard_detailed.html#other-options?)

Incidentally, in https://docs.nnpdf.science/n3fit/runcard_detailed.html#other-options there has been a problem (I guess coming from a merge) and a section is duplicated so if it is indeed a runcard parameter and you need to add a section there, please fix that as well (otherwise I'll do so later)

@siranipour
Copy link
Copy Markdown
Contributor Author

If you set the flag to true and run n3fit <runcard.yml> 1

Sorry, which flag? If it is a runcard flag, could it be used to the Basic Runcard with an explanation (and to the docs somewhere, probably here https://docs.nnpdf.science/n3fit/runcard_detailed.html#other-options?)

Incidentally, in https://docs.nnpdf.science/n3fit/runcard_detailed.html#other-options there has been a problem (I guess coming from a merge) and a section is duplicated so if it is indeed a runcard parameter and you need to add a section there, please fix that as well (otherwise I'll do so later)

Ah good idea, will do that. It is indeed a runcard flag fitting::savepseudodata : true, but this had always been an option

Explaining where to add the flag and what it does
Copy link
Copy Markdown
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

lgtm

@siranipour siranipour merged commit 80ed3f2 into master Sep 1, 2021
@siranipour siranipour deleted the savepseudodata branch September 1, 2021 21:20
@Zaharid Zaharid added the enhancement New feature or request label Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants