Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work in progress of creating a new settings object for asreview. It started out as a small project, but is getting a little bigger, so I thought I would make a draft pull request to get some feedback. Here are the notes I've been taking:
New ASReviewSettings object
Purpose of the current object
Furthermore, the settings object does some type casting. There is a hard coded list of names for which it typecasts the value to a certain type.
Finally it can read settings from a config file, and read model default parameters/type check/type cast whilst doing it.
Related to the settings objects,
BaseModel
class has an attribute calledparam
. This is an attempt to automatically generate the model parameters. It is only used in review/base.py and webapp/api/projects.py to initialize an ASReviewSettings object. It also does some type checking/casting and complains if the type in the signature of__init__
is different from the type of a corresponding stored attribute.Occurences
Review.settings:
Store the info on the settings of the review (model/n_instances/stop_if/n_prior_included/n_prior_excluded/
model_parameters)
Initialize from unknown dictionary.
Store the settings of the state.
Set the settings in the state.
Contents
Classifier/Query/Balance/Feature
Ideas for improvement
(Maybe have a
Settings.from_json()
method.)Model.__init__(**model.settings) = model
Review.__init__(review.model, **review.settings) = review
param
attribute fromBaseModel
.to_json
method so that the state can store the settings.(And make sure
Settings.from_json(settings.to_json())) == settings
.)RandomState(random_state.random_seed) = random_state
andstore it in the settings as it's seed. If the seed has been set for a random state,
you can retrieve it by
random_state.get_state()[1][0]
. We can write a small wrapper aroundthe numpy random state, so that you can only initialize it using a seed, and the seed is
an attribute of the state.
Model.__init__(**model.settings) = model
BaseModel._settings
an abstract property so that you are forced to implement itwhen creating a new model component.
Progress
Model.__init__(**settings).settings == settings
.