Machine Learning 5 Basic Operations
来源:互联网 发布:亲情关怀是什么软件 编辑:程序博客网 时间:2024/05/21 07:37
Machine Learning 5 Basic Operations
5-4 Plotting data
- T = [0:0.1:1]
- Y1 = sin(2*pi*4*t)
- Plot(t,y1) //绘图程序
- Hold on 在原图基础上绘制
- Xlabel(‘time’)
- Ylabel(‘value’)
- Legend(‘sin’,’cos’) 为线进行标注
- Title(‘my plot’) 标题
- Print -dpng ‘myplot.png’ 保存
- Close 关闭图像
- Figure(1); plot(t,y1);
- Figute(2);plot(t,y2);
- Subplot(1,2,1); %Divides plot a 1x2 grid
- Axis([0.5 1 -1 1])
- Clf 干掉所有的图片
- Imagesc(A) 可视化矩阵
- Imagesc(A), colorbar, colormap gray; 为图片添加bar,设置颜色为灰色
5-5 Control Statements for, while, if statements
语法上不对缩进有要求
- for
for i = 1:10, v(i) = 2^i; end;indices = 1:10;for i = indices. disp(i);end;
- while
while i <= 5, v(i) = 100; i = i+1;end;
- break
while true, v(i) = 999; i = i + 1; if(i == 6), break; end;end;
- if else
if v(1) == 1, disp('The value is one'); elseif v(1) == 2, disp('The value is two'); else disp('end');end;
- exit/quit 退出octave
- function 使用时,要把函数放在当前空间
function y = squareThisNumber(x)y = x^2;
function [y1, y2] = squareAndCubeThisNumber(x); % 返回多个值y1 = x^2;y2 = x^3;
function J = costFunctionJ(X, y, theta)% X is the "design matrix" containing our training examples.% y i the class labelsm = size(X, 1); % number of training examplespredictions = X*theta; % predictions of hypothesis on all m examplessqrErrors = (predictions - y).^2; % squared errorsJ = 1/(2*m) * sum(sqrErrors);
- addpath 添加搜索路径
addpath('C:\users\ang\Desktop')
Vectorization
- 向量化可以降低计算时间,提升编程效率
Working on and submitting programming exercises
cd '作业所在目录'submit()
阅读全文
0 0
- Machine Learning 5 Basic Operations
- Machine Learning on Spark -- Basic Statistics
- Chapter1—Basic of Machine Learning
- Machine Learning---5--SVM
- Machine Learning week 5 Neural Networks Learning
- basic operations in sql
- Basic Query Operations
- VIM basic operations
- R dataframe basic operations
- basic file operations
- Machine learning 5---贝叶斯分类
- machine learning yearning 5-6
- machine learning
- Machine Learning
- machine learning
- Machine Learning
- machine learning
- Machine Learning
- sparkSQL读取hive分区表的问题追踪
- css选择器与权重
- Angular开发(二十二)-angular处理复选框选值的问题
- 求助:在把Qt的Qlabel的winid传入第三方库,进行视频播放,图像出不来
- freemarker 自定义TemplateDirectiveModel
- Machine Learning 5 Basic Operations
- Linux USB摄像头采集保存bmp图片
- 算法入门经典第四章例题总结
- Unity获4亿美元融资估值达26亿美元,投资方看好VR/AR领域
- 第四章 创建一个社交网站
- dos 中find 和 findstr 命令
- 安装nmon步骤及安装包
- js---复选框的回显
- Windows server 转移MySQL数据库操作