Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Adaptive sketchpad duration based on accuracy in previous trials

edited October 2018 in OpenSesame

Hi everyone,
I hope I didn't overlook a discussion that might answer my question already.
A brief background: I am conducting a study in which participants see an array of 3D objects and have to indicate whether or not the target was among the stimuli. However, I want to combine the search task with a priming design. So one trial in my experiment consists of two search displays (interrupted by a blank for 50 ms). The objects remain the same in both displays but can be illuminated from either the left or the right.

Now to my question: I would like to adapt the presentation duration of each search display based on the participant's performance in the previous 10 trials. I tried to achieve this via the following inline-script (I set the variable "dur" (=duration) already at the beginning of the experiment to 995 ms):

 #get number of trials 
no_trials = self.get("count_trial_sequence_main")

#if number of trials is 10 (if the rest after division by 11 is 10)
#do adaption process
if no_trials%11 == 10:
    #get presentation duration
    pres = self.get("dur")
    #access the results from the last 10 trials 
    #(make them a float so division gives decimals)
    res=float(sum(responses.correct[:10]))
    #kind of redundand, but divide sum of 0s (incorrect) and 1s (correct)
    #from last 10 trials by 10 for 
    var.recent_acc = res/10
    #we decrease presentation time by 100 ms if participants perform good (> 80%)
    if var.recent_acc > 0.80: var.dur = pres - 100
    #we increase presentation time by 100 ms if participants perform poor (< 80%)
    if var.recent_acc < 0.80: var.dur = pres + 100
    #Although it will never happen, stimulus presentation is at least 50 ms
    if var.dur <= 0: var.dur = 45 </pre>

This script works fine if i only have one keyboard response. However, both search displays are presented for 995 ms (well, kind of) and participants can make a response at any point. Hence, my trial sequence looks like this:

When I conduct my experiment like this, the variable "dur" just increases and the search displays are presented longer and longer. I guess the multiple keyboard responses mess up the logged accuracies but I don't know how to prevent that from happening.

Thanks for any suggestions!

Best,
Christian

Comments

  • Just for clarification: the last line in the markdown slipped in there now. My apologies ;)

  • Hi Christian,

    have you already looked into your output?
    Maybe you are summing up some values (e.g. None) that you do not want in that sum?
    Just an idea.

    Another idea:
    put some print recent_acc in your code, to see what the variable values are. (If you have two screens, you can even see that simultaneously in full screen mode)

    Cheers,
    Stephan

  • Hi Stephan,

    Thank you very much for your suggestions. I looked into the data and the variables correct_r1_m etc. just take the values of 0 and 1 (depending on whether 'timeout' was reached or what response was given).
    I also printed the recent accuracy and it seems that indeed all of the potential responses within a trial are being counted, regardless of the 'run if' statement.
    However, the variable [correct] indeed does correctly indicate whether or not a correct response was made in the course of one trial. So if i was able to access only that variable from the previous ten trials, it should - I think - work.

    Since the variable [acc] also seemed to have suffered under the multiple response items I tried using the reset feedback in the same way as the multiple response items. I've also fixed the error in the run if statements. Now they are 'run if [response_r1_m]==None' etc. Still, the variable [dur] just increases every ten trials regardless of the variable [correct].

    Thanks again!

    Best,
    Christian

  • edited October 2018

    Hi,

    I now fixed this issue. For everyone who has a similar problem:

    I define the variable correct_answer before the loop item. I then count the correct responses given in the inline-script after each trial, as can be seen in the picture above.

    My adapt_training script now looks like this:

    #get number of trials 
    no_trials = self.get("count_trial_sequence_training")
    
    #if number of trials is 10 (if the rest after division by 11 is 10)
    #do adaption process
    if no_trials%11 == 10:
        #get presentation duration
        pres = self.get("dur")
        #we decrease presentation time by 100 ms if participants perform good (> 80%)
        if correct_answer > 8: var.dur = pres - 100
        #we increase presentation time by 100 ms if participants perform poor (< 80%) 
        if correct_answer < 8: var.dur = pres + 100
        #Although it will never happen, stimulus presentation is at least 50 ms
        if var.dur < 0: var.dur = 45 
        correct_answer = 0
    
    

    Every 10th trial, I reset "correct_answer".

    I hope this helps!

    Best,
    Christian

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games