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

Save dataset with model #10

Merged
merged 10 commits into from
Dec 3, 2023
Merged

Conversation

djross22
Copy link
Collaborator

When a model gets initiated, it would be good if the dataset information is saved with it in an easily accessible way, so that the model can be shared between different people, using, for example, a pickled model file.

Then, the user who receives the pickle file, can reconstitute the original model object easily and with minimal risk of error.

In current practice, to share a model, the user who initiates the model passes the code used to generate the model (or assumes that the receiver already has a copy of the same code). This can lead to subtle errors. For example, if the order of the phenotypes (a list of strings) is different between the code use by the initiator and the receiver, the phenotype information will get scrambled, and the receiver may end up inadvertently/unknowingly comparing predictions for one phenotype with experimental values for a different phenotype.

So, the easiest way I could find to do this is to save the dataset object as an attribute of the surface attributer of the model. And, since the surface attribute is typically an object of type lantern.model.surface.Phenotype, the only place I could find to easily make this change was in the Phenotype class constructor methods.

@djross22
Copy link
Collaborator Author

I updated the tests, so now the revised code passes. I'll approve after a couple of days if no one raises any objections.

@djross22 djross22 closed this Nov 25, 2023
@djross22 djross22 reopened this Nov 25, 2023
@ptonner ptonner merged commit cac0bf6 into usnistgov:master Dec 3, 2023
8 checks passed
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