필터 지우기
필터 지우기

How to correctly use the newrb function for multidimensional data?

조회 수: 10 (최근 30일)
Nav I
Nav I 2018년 9월 6일
댓글: Saket Sarawgi 2020년 1월 22일
I've seen the documentation, the code here , here and an answer on the mathworks website, but none of them seem clear enough, since I have tried with some data of my own, and ended up with matrix multiplication errors inside the newrb function. I checked the code, and it seems like my target vector which is 105*1, needs to be a different size, but it doesn't make sense that way.
The problem: I have a set of emotion combinations of Sad, Angry, Happy, Fear which I want to classify into a single emotion. For example, if the combination is Sad, Sad, Fear Sad, then the final choice of emotion is Sad. If it is Sad, Sad, Angry, Angry, the final choice of emotion is Angry. So the input vector would look like this: p = [S,S,F,S; S,S,A,A]; The input vector will have 105 such rows. The number of columns will be 4.
and the target vector would look like this: t = [S; A]; The target vector will have 105 rows and one column.
However, when I feed this data into newrb as: newrb(p, t); I get an error that says that the matrix dimensions must match. I dug into this issue and found that the problem is within the newrb function, where it expects my t matrix to be a 105x5 matrix. But I don't understand how the t matrix can have 5 columns, when it contains only one target emotion per combination of emotions of the input vector.
Could you please help with this?
  댓글 수: 1
Saket Sarawgi
Saket Sarawgi 2020년 1월 22일
Hey Nav,
Even I have a similar issue. I have 4 inputs and 1 output. But the documentation kind of says that - 'Q' must be the dimension of both input and output. How did you manage to solve this problem?
Thanks in advance.

댓글을 달려면 로그인하십시오.

채택된 답변

Greg Heath
Greg Heath 2018년 9월 6일
Individual inputs, targets and outputs are ALWAYS column vectors.
help newrb
newrb Design a radial basis network.
Radial basis networks can be used to approximate functions.
newrb adds neurons to the hidden layer of a radial basis
network until it meets the specified mean squared error
goal.
newrb(X,T,GOAL,SPREAD,MN,DF) takes these arguments,
X - RxQ matrix of Q input vectors.
T - SxQ matrix of Q target class vectors.
Thank you for formally accepting my answer
Greg
  댓글 수: 2
Nav I
Nav I 2018년 9월 7일
Thanks Greg, but I already mentioned I saw the documentation and I couldn't understand how the SxQ fits into my situation, because mine is a 105x1 matrix, but newrb seems to require a 105x5 matrix. Could you show me how I should send my p and t matrices into newrb? Is there some extra padding required to convert the t matrix into a 105x5 matrix?
Let's say my data is: S=1;A=2;F=3;H=4; p = [S,S,F,S; S,S,A,A; H,H,A,H]; and t = [S; A; H];
I can't simply send it as newrb(p, t); So how should it be done?
Nav I
Nav I 2018년 9월 7일
Never mind. It's working now. Odd...

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Greg Heath
Greg Heath 2018년 9월 7일
???...I cannot understand your confusion !!!
ESPECIALLY since the documentation explicitly states
X - RxQ matrix of Q input vectors.
T - SxQ matrix of Q target class vectors.
Why is this so hard to understand???
Greg
  댓글 수: 1
Nav I
Nav I 2018년 9월 7일
Because I already tried all combinations of newrb(p',t), newrb(p,t'), newrb(p',t') and it just does not work.
I have seen an example where the 1 dimensional t matrix was converted into 3x3 dimensions just for feeding it into newrb. So it became [1 -1 -1;-1 1 -1;-1 -1 1]. Thats why I decided to ask here. Am I supposed to do something like that and what purpose does it serve? I'd really appreciate some example code for my situation, since the documentation covers only simple situations and tutorials are non existent.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by