Howdy, Stranger!

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

Supported by

Can't get feedback with accuracy to work

edited October 2018 in OpenSesame

Hi,

I'm working on a MET task (math) where the participant chooses from 5 different difficulty levels. Each difficulty level has a different maximum grade: level 1 - a 6, level 2 - a 7, level 3 - an 8, level 4 - a 9, level 5 - a 10.

I followed someones advice here on how to calculate the accuracy, and I tried calculating the accuracy (grade) by multiplying the acc with 0.6 - 1.0 for the different difficulty levels.

The problem is that it just gives a 6 if you've chosen difficulty level 1, regardless of the amount of correct answers. This is the same for each level, it just gives the maximum grade.

I hope someone can help me understand what I'm doing wrong here.

I'm sorry, but I don't know how to post the code in the correct format. This is the code for the inline script (run phase) which comes after the text input form in the experiment:

import numpy
import string


CR_ans_canvas = canvas()
CR_answer =  var.number1 + var.number2 + var.number3
exp.set("CR_answer", CR_answer)


if var.CR_response == CR_answer:
    var.set("CR_correct", 1)
    var.set("CR_incorrect",0)
    var.set("CR_late", 0)

else:
    var.set("CR_correct", 0)
    var.set("CR_incorrect", 1)
    var.set("CR_late", 0)


if var.CR_response == "":
    var.set("CR_late", 1)
    var.set("CR_correct", 0)
    var.set("CR_incorrect", 0)


##update feedback variable
self.set_response(response=var.CR_response,correct=var.CR_correct)


##show the answer_canvas
CR_ans_canvas.show()



##set the total amount of responses (trials) to 5 
self.experiment.total_responses = 5


##if the response was correct, increase the amount of correct responses by one
if self.get("CR_correct") == 1:
    self.experiment.total_correct += 1


##save the total correct under the variable OpenSesame saves it to
exp.set("total_correct",self.experiment.total_correct)


##calculate the total accuracy
self.experiment.acc = 10 * (self.experiment.total_correct / self.experiment.total_responses)


##calculate the accuracy for the chosen levels
if var.response_KeuzeKey_CR == 1:
    self.experiment.acc = 0.6 * self.experiment.acc
elif var.response_KeuzeKey_CR == 2:
    self.experiment.acc = 0.7 * self.experiment.acc
elif var.response_KeuzeKey_CR == 3:
    self.experiment.acc = 0.8 * self.experiment.acc
elif var.response_KeuzeKey_CR == 4:
    self.experiment.acc = 0.9 * self.experiment.acc
elif var.response_KeuzeKey_CR == 5:
    self.experiment.acc = self.experiment.acc


##save the accuracy under the two variables OpenSesame saves it to
exp.set("acc",self.experiment.acc)
exp.set("accuracy",self.experiment.acc)`

Comments

  • Hi,

    This looks like an integer division problem. See here for example: https://www.geeksforgeeks.org/division-operator-in-python/

    Does it work, if you replace self.experiment.acc = 10 * (self.experiment.total_correct / self.experiment.total_responses) with self.experiment.acc = 10 * (self.experiment.total_correct / float(self.experiment.total_responses))`?

    Eduard

    Buy Me A Coffee

  • Hi Eduard,
    Thanks for your suggestion, but it still doesn't work.
    It seems to me that something goes wrong with the (self.experiment.total_correct / float(self.experiment.total_responses)) part. Maybe it always returns 1 for some reason.
    Femke

  • Maybe it always returns 1 for some reason.

    You can easily test that, by printing out the values of relevant variables into the debug window. E.g.

    self.experiment.acc = 10 * (self.experiment.total_correct / self.experiment.total_responses)
    print 'acc: ', self.experiment.acc
    print 'total_correct: ', self.experiment.total_correct
    print 'total_responses: ',self.experiment.total_responses
    

    That's generally the first thing you should do when you don't know why your code is not doing what it is supposed to do.

    Eduard

    Buy Me A Coffee

  • I tried, it it gives me an error:

    `self.experiment.acc = 10 * (self.experiment.total_correct / self.experiment.total_responses)
    print 'acc: ', self.experiment.acc
    print 'total_correct: ', self.experiment.total_correct
    print 'total_responses: ',self.experiment.total_responses

    NameErrorTraceback (most recent call last)
    in ()
    ----> 1 self.experiment.acc = 10 * (self.experiment.total_correct / self.experiment.total_responses)
    2 print 'acc: ', self.experiment.acc
    3 print 'total_correct: ', self.experiment.total_correct
    4 print 'total_responses: ',self.experiment.total_responses
    5

    NameError: name 'self' is not defined`

  • I also saw this in the debug window: UserWarning: var name is stored as attribute of item experiment
    % (var, self.item.name)

  • Hi Femke,

    You have to run the experiment. Just copying the code to the window won't work. Can you try again? Or upload the experiment?

    (and sorry for the delay).
    Eduard

    Buy Me A Coffee

  • Hi Eduard,
    I tried running the experiment first, but that also didn't work. Can I email you the experiment? It needs excel files to run, so emailing would be easier I think.
    Regards,
    Femke

  • Hi,

    You can zip everything and send it to me via a PM.

    Eduard

    Buy Me A Coffee

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