So X is your data matrix... and theta is a vector of parameters
in our case, we're just looking at 2 parameters... theta0 and theta1.
In general, this can go up to n+1 parameters, including the bias parameter theta0.
So the goal... is to compute theta^T * X for each row, yes?
we want to compute the hypothesis for each sample.
so you would agree that the hypothesis h(x) = theta^T * x yes?
that's just for ONE sample
so we want to do this in MATLAB vectorized. Instead of looping over and calculating this for each sample, this can very easily be done with a matrix multiplication.
Behold
You would agree that the dot product: x dot y is equal to y dot x right?
because multiplication is commutative.
it's a sum of products of terms. It doesn't matter what order you multiply each value.
in a similar fashion, theta^T * x = x^T * theta.
Multiply X*theta and you'll see that each row of the result is the hypothesis for each sample.
In a similar fashion, you can also do theta^T * X
however, what you will get is a row vector, not a column vector.
you'd want the column vector because it naturally fits with the way your data is shaped.
ah by the way I'm reading it haha, I just forgot to let you know XD
And no problem! It's a great start tutorial - thanks Ray :)
I understand the mechanics of matrix multiplication, it's just it's a little awkward to visualize right now x_x I'll finish reading this pdf first though :)
Wrote a tiny bit of comments on the process of logistic regression: Hope this helps someone :)
% cost function: 1/m * sum(cost(theta))
% cost(theta) = -[(1-y)*(log(1-sigmoid(theta))) + (y)*(log(sigmoid(theta)))]
% gradient descent = 1/m * sum(cost'(theta))
% ==== I didn't include the chain_rule_postfix which is just theta^T*Xi
% deriv which is just Xi ====
% cost'(theta) = (1-y)*(1/(1-sigmoid(theta))*(-sigmoid'(theta)) +
% (y)*(1/(sigmoid(theta)))*(sigmoid'(theta))
% cost'(theta) = -(1-y)*(sigmoid(theta)*(1-sigmoid(theta))/(1-sigmoid(theta)))+
% (y)*(sigmoid(theta)*(1-sigmoid(theta))/(sigmoid(theta)))
@OneRaynyDay you should learn some matrix rules before pushing yourself to code in matlab, matlab cant assist you step by step how to calculate, it just processes
@OneRaynyDay LA is, either super unintuitive or extremely obvious. Once you reaaaaally understand it (this takes time, it took me years), then its ridiculusly obvious why this matrix or that matrix behaves that or this way
UTF-8 is a character encoding capable of encoding all possible characters, or code points, in Unicode.
The encoding is variable-length and uses 8-bit code units. It was designed for backward compatibility with ASCII, and to avoid the complications of endianness and byte order marks in the alternative UTF-16 and UTF-32 encodings. The name is derived from: Universal Coded Character Set + Transformation Format—8-bit.
UTF-8 is the dominant character encoding for the World Wide Web, accounting for 84.6% of all Web pages in August 2015 (with the most popular East Asian encoding, GB 2312, at 1.3%). The...
ok so basically what I can do is just compute the pca of invisdual images for eg sya 10 images from that dataset of 300 and then store then in a cell array in a amt file and then
Sorry I can not help you more in a chat, but its just complicated. I teach PCA in university, and I spend hours triying students to get it. Its just not possible in a chat
It has its tricks indeed. It is very important one understands everything perfectly before teaching. Also one needs to be able to change the way one explains the stuff, as different people understand things differently
I believe SO is quite good training to be a teacher
@AnderBiguri - Well, yesterday I managed to get the cuda version of my desired filter working, but the problem with it is that I need 16bit support, and all I have is 8bit, and I have no idea what to do to make it work with 16bit as well
So I'm currently down to several options: 1) use the cpu version and keep the precision, but pay with computation time 2) use the cuda version and lose precision, but gain performance 3) get help \ hire somebody to adapt the 16bit filter to work with cuda
It's opensource, but I don't know how/what to modify for it to work... It can be something as simple as uploading a Mat to the gpu, and it can be something crazy like major refactoring
@LuisMendo - what is this, I don't even @AnderBiguri - \opencv3\modules\photo\src\denoising.cpp and denoising.cuda.cpp
The function I care about is this: void cv::cuda::fastNlMeansDenoising(InputArray _src, OutputArray _dst, float h, int search_window, int block_window, Stream& stream)
this one can be as beneficial: void cv::cuda::nonLocalMeans(InputArray _src, OutputArray _dst, float h, int search_window, int block_window, int borderMode, Stream& stream)
You can find both files in there. The denoising.cpp file contains the 16bit modification (CPU), and the denoising.cuda.cpp contains the functions I want to be able to run with 16bit support
It's common to use the end keyword as a shortcut for accessing or extending an array in Matlab, as in
>> x = [1,2,3];
>> x(1:end-1)
ans =
1 2
>> x(end+1) = 4
x =
1 2 3 4
However, I was surprised to find that the following also works
>> x(1:min(5, end))
ans =
1 2 3 4
...
Due to my lack of skill in dealing with cmake and VS.. I downloaded the precompiled binaries after wasting over a day trying to compile it on my own :x
MATLAB's classes totally baffle me sometimes. If I have scatter(1, 1, 150, 'k', 'o'); [~, icons, ~, ~] = legend('Circle'); and I try to get the Type of each member of icons, icons(1).Type functions fine, icons(2).Type functions fine, yet icons(:).Type throws an No appropriate method, property, or field 'Type' for class 'matlab.graphics.primitive.world.Group'. error