Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

How to rerun a loop after checking accuracy ?

aswvaswv Posts: 9

I am new to opensesame and I find it really cool. Get software.

I need help with the following scenario.

In my experiment, there is a learning phase and a testing phase. Participants learn words during the first phase(loop-sequence) and are tested in the second phase(loop-sequence).
After the test phase, I want to re-run the learning phase(loop) if the accuracy is less than 80%.

My problem is how do i specify, if the acc is less than 80, run this loop.

I tried python script, but its not working for me.

Comments

  • sebastiaansebastiaan Posts: 2,950
    edited May 2017

    Hi,

    Say that you want to repeat block_loop when accuracy is less than 80%, then you could do the following:

    • Embed block_loop in another loop, here meta_loop
    • Set the repeat value for meta_loop very high (so that it's practically infinite)
    • Set the break-if statement for meta_loop to [acc] >= 80, and disable 'Evaluate on first cycle'

    Do you see the logic?

    Cheers,
    Sebastiaan

    image.png 68.6K

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • aswvaswv Posts: 9

    Works perfect.

    Thanks Sebastian...

  • fefflefeffle Posts: 2

    Hi there,

    I am trying to do a similar thing and have tried this method but it seems to take the cumulative accuracy across all completed block repetitions. Is there a way to break the loop based only on accuracy of the most recent block?

    Thanks!

  • eduardeduard Posts: 1,115

    Hi,

    If you reset the feedback in the end (or the beginning) of a block, only the most recent block should be used for the computations. So just drag the reset_feeback item in the beginning of your block_sequence and you should be set.

    Good luck.

    Eduard

  • fefflefeffle Posts: 2

    That worked a treat, thanks so much!

  • Matanel WeissmanMatanel Weissman Posts: 21
    edited December 2017

    Hello, I have done what sebastiaan said and it worked, but I need an extra thing.

    I need please the experiment to end if the participant didn't reach to 80% accuracy. How can I do that?
    I need the exp to end after two tries to reach 80% acc - I know how to repeat if didn't get to 80% but I don't know how to end the exp.

  • sebastiaansebastiaan Posts: 2,950

    Hi @"Matanel Weissman",

    I would use a simple inline_script that raises an Exception in this case. That will cause the experiment to exit. Like so:

    if var.acc < 80:
        raise Exception('Accuracy to low!')
    

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

Sign In or Register to comment.