Skip to content

Separate the lottery evaluation and trial selection + other improvements - #113

Open
skim725 wants to merge 2 commits into
YaleDecisionNeuro:masterfrom
skim725:73_new_lottery
Open

Separate the lottery evaluation and trial selection + other improvements#113
skim725 wants to merge 2 commits into
YaleDecisionNeuro:masterfrom
skim725:73_new_lottery

Conversation

@skim725

@skim725 skim725 commented Jun 12, 2017

Copy link
Copy Markdown
Collaborator

Addresses #73.

@shippy shippy added this to the Essential features milestone Jul 9, 2017
Comment thread tasks/SODM/SODM_pickTrials.m Outdated

% want to pick a trial from each of the 4 types of blocks
% use getOneBlockPerCondition
getOneBlockPerCondition(data.blocks)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Either delete this line (as it merely prints one possible selection to stdout) or save it into a variable and use it in the for loop.

@shippy

shippy commented Jul 9, 2017

Copy link
Copy Markdown
Contributor

No way around it: this changes API for pickAndEvaluateTrial in a way that would break UVRA. Since the function is never invoked, it doesn't actually need to - pickAndEvaluateTrial can be labeled deprecated, and its innards mostly factored out into showLotteryEvaluation (which should perhaps be showTrialEvaluation?).

Prior to merge:

  • revert argument change (actually, all changes) in pickAndEvaluateTrial (UVRA depends on being able to pass DataObject to it)
  • replace eligible logic in pickAndEvaluateTrial (which is almost everything past line 13) with showLotteryEvaluation
  • cut out unnecessary code
  • document the introduced functions better

@@ -0,0 +1,33 @@
% Want a function which, given an input argument of the block number,
% returns the condition of that block (medical or monetary) and the block's

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, just noticed this — this does not describe the function at all. (Or rather, it describes lines 23 and 24 of the function.)

% Determine message to display

% For monetary gamble
if strcmp(config.runSetup.blockName, "Monetary") == 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will not work on Matlab versions prior to 2016b be — don't ask me why, but Matlab was very strict that strings are denoted by apostrophes, not by quotes.

Also, note that this code doesn't create a basecase for a block whose name is neither monetary nor medical, which means that it will fail hard in those cases.

conditions = subsetofblocs.conditions;

payoffKinds{blockIdx} = conditions.payoffKind;
beneficiaries{blockIdx} = conditions.beneficiary;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The way to generalize that for tasks with different kinds of conditions would be to a) poll fieldnames in block.conditions and make them into table headers, b) populate the table with the condition assignments extracted from each block. This is perfect for a vectorized approach -- in fact, cellfun(@(block) struct2table(block.conditions), blocks) would be a one-line expression of that logic (haven't checked).

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