0
l2 = [{'walk', 'water', 'warm', 'cheer', 'word', 'happy', 'whim', 'womb', 'wear', 'well'};
{'hello', 'here', 'hat', 'that', 'happy', 'hide', 'awesome', 'there', 'howl', 'harry'};
{'look', 'listen', 'lyer', 'hateful', 'lost', 'hatred', 'plot', 'player', 'plow', 'lay'};
{'goat', 'meat', 'hope', 'house', 'love', 'wall', 'down', 'up', 'sky', 'mount'};
{'go', 'golf', 'loser', 'gyrus', 'terrible', 'gallore', 'tug', 'thor', 'gear', 'leg'}];

So I have this data above, and I want to be able to separate each row in terms of it being either positive or negative. As you can see above: My first row has 2 positive targets amongst neutral words and the third row has 2 negative targets amongst neutral words.

Now if I was running this where the participant saw each word in a sequence per row, how can I get an accuracy for their response to a row with positive targets vs negative target?

Any ideas? Please help, I just cant figure it out

So far I was thinking of using logical indexing to separate positive targets and negative target, but how do I do that with cell rows?

I have this:

positive_t = [1 1; 1 1; 0 0; 1 1; 0 0]

This above denotes all the positive targets as 1 and negative targets as 0 but how would I be able to separate them properly row by row? Also. Then if I want to find how many time the participants got the answer for positive row vs negative row. How can I save the accuracy of that?

13
  • You need some dictionary which contains words that are positive, and one that contains words that are negative. Then you simply use ismember: ismember(l2,dictionary)
    – Adriaan
    Nov 29, 2015 at 21:04
  • How do I make that dictionary? Can you please help me? Nov 29, 2015 at 21:20
  • No. I cannot help you. You'd need to copy the entire Oxford dictionary and say for each word whether it's positive, neutral or negative. Seems like a lot of work to me, but since you cannot determine by other ways (perhaps advanced Neural Network or machine-learning) what you are looking for, this is the way to go imho.
    – Adriaan
    Nov 29, 2015 at 21:22
  • But thats too much work. All I need to do is separate those CERTAIN positive and negative targets. I can accomplish it through logical indexing, i just dont know how and i need help with that. Nov 29, 2015 at 21:28
  • 2
    Just a comment in general: text processing is not a strongpoint of Matlab. If I had a big Natural Language Processing (NLP) project, I probably would use something else. Nov 29, 2015 at 22:07

1 Answer 1

0

I assume 1) you want to test a person's ability to pick out positive or negative words and 2) you already have a standard answer ( as your test standard ) that you're going to compare testee's answer against.

I don't know what your definition of positive is, so I'm also being tested by you in a sense, but let's assume that you have this standard answer :

std_answer = logical([ 0 0 0 0 0 1 0 0 0 1;...  % 'happy' and 'well'
               0 0 0 0 1 0 1 0 0 0;...          % 'happy' and 'awesome'
               0 0 0 1 0 1 0 0 0 0;...          % 'hateful' and 'hatred'
               0 0 1 0 1 0 0 0 0 0;...          % 'hope' and 'love'
               0 0 1 0 1 0 0 0 0 0 ]);          % 'loser' and 'terrible' 

The std_answer here is an logical array that has the same number of elements as your l2. It has value of 1 wherever your answer is ( which of course, as a tester you already know. Here I'm just taking some guess and assume the standard answer to make an example) and 0 otherwise.

You can apply this mask to your l2 and the result will be your answers

answers = l2(std_answer);

If you really wish to do it row by row, of course you can do this:

for ii = 1:size(l2, 1)
    sublist = l2(ii, :);
    submask = std_answer(ii, :);
    answer = sublist(submask);
end

At the end of the test, you'll have a testee response ( let's say you named it test_response) that's also a 5*10 logical array. You can compare the testee response to standard answer by using logical operation:

score = test_response & std_answer ;

score will also be a logical array whose 1 indicate a match between testee response and standard answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.