machine leanring 笔记 octave命令笔记

来源于coursea 的公开课

A*B 一般意义的矩阵相乘

A.*B矩阵各位相乘

A.^2 A矩阵的每个数平方

1./A  对A矩阵的各位取倒

 .表示对每一项都如此操作

log (A)

exp(A)

abs(A)

-A  th

v+ones(length(v),1) add vector of all ones to v

or v+1  

A'   is a transpose

max(A) max vluae of a

[max,ind]=max(a)         the first are the value,and the second is index

a<3                       comparsion for each element in matrix

fina(a<3)             tell me which element is less than 3

 magic                           function return a magic matrix

sum(A)

prod meand product (乘积 )

ceil(A) 

floor()

max(rand(3),rand())

max(a,[],1)                max of each colom

max(a,[],2)                max of each row

A(:)                           every element in a vector

sum(A,1)                   sum of 1 colum of Ai

sum(A,2)       sum of each row of A

flipud(A)        A的山下颠倒

plot(x,y)                   以第一个为横轴,第二个为纵轴绘图

hold on 

plot(x,y,'r') 追加内容

xlebel("")

ylebel("")

title("")

print -dpng "my.png"  save as a file in png format

figure(1);plot (t,y1)    分割子图

axis([0.5 1 -1 1])       x range form 0.5 to 1 t range from -1 to 1

clf  clear the figure

imagicesc(A)     生成彩色块图

colorbar    彩色边栏对应图

colormap gray  灰白度图 使用 colormap("list“) look for what's avaliable

zero(n,m)  return a matrix that nXm elemetary are the 0

for i=1:10,

code

end;

indecse=1:10

for i=indecs     the same as above

exit 

quit 

function y=mfunc(x)

y=x^2

addpath('d:ml')

function [y1,y2]=mcun1(x)

return multipule values

好像必须用单引号

theta regularition 时候不考虑theta0 ;

nn grad 的时候  g(Z1) 我第一次将 A2带入g得不到正确的结果

When training neural networks, it is important to randomly initialize the parameters for symmetry breaking

2One effective strategy for choosing init is to base it on the number of units in the network. A good choice of init is init = √6/(√Lin+Lout), where Lin = sl and Lout = sl+1 are the number of units in the layers adjacent to Θ(l

mu = mean(X);
X_norm = bsxfun(@minus, X, mu);

sigma = std(X_norm);

X_norm = bsxfun(@rdivide, X_norm, sigma);

bsxfun  函数的作用

plot 函数只在vector相等时画图 不相等会报错,也不绘图。

原文地址:https://www.cnblogs.com/sfzyk/p/6204706.html