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

324 random bootstrap seed #1

Merged
merged 7 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/src/stores/OptionsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class OptionsStore {
}

@observable optionsList = [];

@computed get canEdit() {
return this.rootStore.mainStore.canEdit;
}
Expand All @@ -18,11 +19,13 @@ class OptionsStore {
if (this.optionsList.length === 0 || force) {
const option = _.cloneDeep(constant.options[this.getModelType]);
this.optionsList = [option];
this.optionsList[0].bootstrap_seed = Math.ceil(Math.random() * 1000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

As implemented, doesn't this set the seed attribute on all options, even those which don't have have a bootstrap_seed, like for example dichotomous options?

}
}

@action.bound addOptions() {
const option = _.cloneDeep(constant.options[this.getModelType]);
option.bootstrap_seed = Math.ceil(Math.random() * 1000);
this.optionsList.push(option);
this.rootStore.mainStore.setInputsChangedFlag();
}
Expand All @@ -40,6 +43,7 @@ class OptionsStore {
this.optionsList.splice(val, 1);
this.rootStore.mainStore.setInputsChangedFlag();
}

@action.bound setOptions(options) {
this.optionsList = options;
this.setDefaultsByDatasetType();
Expand All @@ -48,13 +52,15 @@ class OptionsStore {
@computed get getModelType() {
return this.rootStore.mainStore.model_type;
}

@computed get maxItems() {
return this.rootStore.mainStore.isDesktop
? 1000
: this.rootStore.mainStore.isMultiTumor
? 3
: 6;
}

@computed get canAddNewOption() {
return this.optionsList.length < this.maxItems;
}
Expand Down