How to correctly use the newrb function for multidimensional data?

Illustration
Navi - 2021-06-17T14:30:51+00:00
Question: How to correctly use the newrb function for multidimensional data?

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.

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

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.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!