注:每次使用的时候,都需要到网上各种搜索,太痛苦了,专门放一个地方,以方便自己查阅。
所有的i,j之类的小写代表常量,大写的X,Y代表矩阵或者向量
1、矩阵及向量:
ones(i,j):
zeros(i,j)
pinv(X):
X’:
find(条件):
示例用户:将Y向量中的0,与1分开。 Y1=find(Y1); Y0=find(Y0);
则X条件矩阵中的对于结果1的记录集,就可以使用X(Y1,:)来标识。
2、矩阵及向量运算:
最重要的是理解,在机器学习里面使用的各种矩阵的操作。例如:
theta0+theta1X1+theta2X2
能够一眼就转成THETA’*X.
另外在吴恩达的课件里面,能够使用矩阵计算的就不要使用FOR循环,一方面可以使你写的程序程序效率更高,另外一方面可以加深对矩阵运算的理解并熟练运用。
3、基本运算符:
floor(Number),取整。例如:floor(0.49/0.0024)=204;
Octave里面的Mod,没有搞清楚,如果使用mod(0.49/0.0024)=0.00040000
4、plot画图:
plot(x1(y1,2),x1(y1,3),’+’);
hold on
plot(x1(y0,2),x1(y0,3),‘o’,‘MarkerFaceColor’,‘r’);
Format arguments:
linestyle
‘-’:Use solid lines (default).
‘–’:Use dashed lines.
‘:’:Use dotted lines.
‘-.’:Use dash-dotted lines.
marker
‘+’:crosshair
‘o’:circle
‘*’:star
‘.’:point
‘x’:cross
‘s’:square
‘d’:diamond
‘^’:upward-facing triangle
‘v’:downward-facing triangle
‘>’:right-facing triangle
‘<’:left-facing triangle
‘p’:pentagram
‘h’:hexagram
color
‘k’:blacK
‘r’:Red
‘g’:Green
‘b’:Blue
‘y’:Yellow
‘m’:Magenta
‘c’:Cyan
‘w’:White