[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Getting the message "warning: implicit conversion from real matrix to re
From: |
brunoazev |
Subject: |
Getting the message "warning: implicit conversion from real matrix to real scalar" |
Date: |
Tue, 26 Nov 2013 05:18:12 -0800 (PST) |
I have done an exercise to Coursera (predict handwritten digits), and
everything seems to be right but I'm getting this warning message and I
don't know why. Althought this message appears, the results are right as you
can see by the image below:
<http://octave.1599824.n4.nabble.com/file/n4659539/sshot-1.png>
The code that results on that warning is:
function p = predict(Theta1, Theta2, X)
%PREDICT Predict the label of an input given a trained neural network
% p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given
the
% trained weights of a neural network (Theta1, Theta2)
m = size(X, 1);
num_labels = size(Theta2, 1);
p = zeros(size(X, 1), 1);
*a = sigmoid([ones(m,1) X] * Theta1');
[value,p] = max(sigmoid([ones(size(a),1) a] * Theta2'),[],2);*
________________________________
However, this works fine:
X = [ones(m, 1) X] ;
for c = 1:num_labels
X2 = [ones(m, 1) (sigmoid(X * Theta1'))];
predict(:,c) = sigmoid(X2 * Theta2(c,:)');
end
[predict, p] = max(predict, [], 2);
______________________________________
My doubt is why I'm getting the warning message in the first solution I
made.
Extra information:
X = 400 input layer units (excluding the extra bias unit which always
outputs +1).
Theta1 has siz e 25 x 401.
Theta2 has size 10 x 26.
--
View this message in context:
http://octave.1599824.n4.nabble.com/Getting-the-message-warning-implicit-conversion-from-real-matrix-to-real-scalar-tp4659539.html
Sent from the Octave - General mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Getting the message "warning: implicit conversion from real matrix to real scalar",
brunoazev <=