| Reference | Downloads | Github

Feedback in Rating Scale + Labeling


I am trying to create an experiment which participants can label the facial expressions in accordance with the given words. I use “rating scale” as a response to collection methods. I have three choices on the scale that participants could choose. After they gave their choice, they will immediately receive the feedback whether their answer was correct or not. I have created several codes using the “code component” to build this up. But I encountered several problems.

1/ For some reasons, even though I gave the correct answer, the feedback is still saying that I was wrong. I tried to flip the code, and it did tell me I was correct after I gave a correct answer. However, since I mentioned I have three choices on the scale, and the feedback end up being like “two choices will be correct, one choice is wrong” and the other way around. I guess my question is, what I should write in the code so that in three choices, there is only one correct answer and two incorrect answers.

Begin Experiment:

nRepsCorr = 0
nRepsIncorr = 0

Begin Routine:

if rating1.corr == 1:
    nRepsCorr = 1
    nRepsIncorr = 0
    nRepsCorr = 0
    nRepsIncorr = 1

2/ Since there are three options displaying on the rating scale, they are not always the same but much depend on the stimulus. I created an excel file for the choices, but for some reasons, they appeared oddly. Look below for example:

Begin Routine:

list_of_labels = [Choice1, Choice2, Choice3]  
rating1.choices = list_of_labels
for iii, label in enumerate(rating1.labels):

Each Frame:

if rating1.getRating() == CorrectAns:
        rating1.corr = 0
        rating1.corr = 1

=> For some reasons the labels only showed up at the tick marks #1 and #3 only
This is how it looks like for one trial:
The choices should appear as “Angry, Fearful, Neutral” but at the second tick marks, nothing was shown. The #3 tick mark’s acceptValue was “Neutral” instead of “Fearful” as shown on the tick marks.

I decided to try clicking on a different tick mark, and the acceptValue shown as “Fearful”

(The correct answer for this trial is “Angry”)
The name of the labels does not match with the showAccept value too!
Below is how my excel file looks like for this particular trial.


For “RatingScale” component, I use the “custom” function, and I designed my scale like this:


I was trying to recreate every single step again and again, but it always ended up with the same results. I wonder what the problem was…
If you have some insights, and you don’t mind, please share with me. I appreciate all your help.
Hope to hear your thoughts.
Thank you very much!

Hi, are you trying to gain two ratings? One to identify the emotion, and one of the magnitude of emotion? If so,
have you considered using the new Slider component? It will allow you to create your rating with less complication. Two simple solutions for this type of task:

  1. You could either create two sliders, one for identifying emotion, and a second for the strength of emotion.
  2. Create a slider for emo. magnitude, and create your own buttons for type of emotion using polygon stim, with text component labels, positioned however you wish. You would provide your mouse component with the correct answer corresponding the those buttons. Mouse has a isPressedIn method for testing whether the mouse was clicked in a shape

Hi there,

Thank you very much for your email.
No, I only want a rating with different choices (like a multiple choice question), and the choices will be different each trial. I tried to write a code for displaying the choices, but what the scale shown and the acceptValue did not match when I ran the experiment.

Ok, the reason I ask is because your example has two ratings. One rating between 1 to 3 (not at all, extremely) and then you have the emotion ratings. I take it you only want the emotion ratings (i.e., fear, anger etc) and a button in the middle to confirm the rating?

Hi there,
Thank you for your clarification.
It was my fault; at the time, I could not figure out how to delete the description (“1…3”), using the custom function in the RatingScale component. I just changed the pictures in the post, so I hope there will be no confusion.
Yes, I only have one rating (rather a multiple choice question) in my experiment. There will be a button below the scale to confirm the choice. However, the value showed in the confirmation button and on the tick mark does not match, which I was struggling. Furthermore, the tick marks do not fully show all the choices I put in my excel file (as attached in the post).

One of the limitations of RatingScale is that it does not update once it has been instantiated. What you have to do if you want to change the scale is create a new rating scale in a code component at the beginning of every trial. So, begin by creating your rating scale in Builder as normal, then add a code component after the rating scale, and add the following (adapted to your experiment) in the Begin Routine tab: E.g:

myRating = ['a','b','c']
shuffle(myRating)  # Only shuffling to show the ratings change on every trial - ignore this in your exp.
rating = visual.RatingScale(win=win, name='rating', marker='triangle', size=1.0, pos=[0.0, -0.4], choices=myRating, tickHeight=-1)

Just make sure you keep the name of the rating scale the same as the one in Builder.

Hi there,

Thank you for your response!
I tried the code, and edited here and there in the experiment, and it works. I also figured out the feedback problems as well !!!

Thank you very much once again for all your help! :grinning: I appreciate it a lot !!!

1 Like