In Machine learning course, I am unable to visualize below input.
we have below equation in Logistic Regression :
We can write it in octave as below in sigmoid.m
:
g = (1 ./ ( 1 + e.^(-z)));
Now, to calculate costFUnction.m
, we are getting probability as:
h = sigmoid(X*theta);
From, the above picture, shouldn't it be:
h = sigmoid(theta'*X);
What am I missing here. I am newbie to ML so forgive me if I am missing something here.
The most important thing is to understand what every vector means. In most courses they talk about
h = theta'* x
But here they use colum vectors so h is a scalar for one training example. The vectorized notation tells you
h = X * theta
Where X is a matrix all your training examples, where each example is a row and the features are colums. So mxn with m number of training examples and n number of features. You want h to give an output for each training example so you want amx 1 matrix. You know that theta will be anx 1 matrix as it is a theta for each feature and you have 1 model. If you do the second formula i wrote down at the top you will get as hamx 1 matrix which is prefered.
If you'll refer to the material shared here , you can see that
and what we want from h(x)
is:
to visualize it:
X = [ 1 x1 ; 1 x2 ; 1 x3;]
theta = [ t0 t1;]
X * theta
% will give [ t0+(x1*t1) ; t0+(x2*t1) ; t0+(x3*t1) ; ]
where each row of above matrices represent separate hypothesis.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.