多语言展示
当前在线:500今日阅读:31今日分享:25

使用Ubuntu系统安装Octave进行机器学习

在学习斯坦福大学的机器学习课程中,老师推荐使用Octave高级语言进行机器学习的软件开发工具,这里介绍如何在Ubuntu系统下安装Octave。
工具/原料

安装了Ubuntu操作系统的电脑

方法/步骤
1

使用apt-get install命令安装Octave:hxb@littleStar:~$ sudo apt-get install octave[sudo] hxb 的密码: 正在读取软件包列表... 完成正在分析软件包的依赖关系树       正在读取状态信息... 完成       下列软件包是自动安装的并且现在不需要了:  linux-modules-4.15.0-20-generic使用'sudo apt autoremove'来卸载它(它们)。...

2

在命令行运行如下octave命令启动octave:hxb@littleStar:~$ octave该命令会打开Octave图形化界面,按照操作提示就可以打开软件界面

3

在命令行可以直接运行Octave语言指令:>> A[1,2,3;4,5,6;7,8,9]parse error:  syntax error>>> A[1,2,3;4,5,6;7,8,9]     ^>> A =[1,2,3;4,5,6;7,8,9]A =   1   2   3   4   5   6   7   8   9>> B = AB =   1   2   3   4   5   6   7   8   9

4

使用Octave矩阵和向量的运算>> A =[1,2,3;4,5,6;7,8,9]A =   1   2   3   4   5   6   7   8   9>> B =[2,3,4]B =   2   3   4>> C = A*Berror: operator *: nonconformant arguments (op1 is 3x3, op2 is 1x3)>> B=[2;3;4]B =   2   3   4>> C=A*BC =   20   47   74

5

使用Octave进行绘制数学图形sin和cos图形1.定义x值>> x = [0:0.01:0.80]x = Columns 1 through 13:   0.00000   0.01000   0.02000   0.03000   0.04000   0.05000   0.06000   0.07000   0.08000   0.09000   0.10000   0.11000   0.12000 Columns 14 through 26:   0.13000   0.14000   0.15000   0.16000   0.17000   0.18000   0.19000   0.20000   0.21000   0.22000   0.23000   0.24000   0.25000 Columns 27 through 39:   0.26000   0.27000   0.28000   0.29000   0.30000   0.31000   0.32000   0.33000   0.34000   0.35000   0.36000   0.37000   0.38000......2. 定义Y函数:>> y1 =sin(2*pi*4*x)y1 = Columns 1 through 13:   0.00000   0.24869   0.48175   0.68455   0.84433   0.95106   0.99803   0.98229   0.90483   0.77051   0.58779   0.36812   0.12533 Columns 14 through 26:  -0.12533  -0.36812  -0.58779  -0.77051  -0.90483  -0.98229  -0.99803  -0.95106  -0.84433  -0.68455  -0.48175  -0.24869  -0.00000 Columns 27 through 39:   0.24869   0.48175   0.68455   0.84433   0.95106   0.99803   0.98229   0.90483   0.77051   0.58779   0.36812   0.12533  -0.12533 Columns 40 through 52:  -0.36812  -0.58779  -0.77051  -0.90483  -0.98229  -0.99803  -0.95106  -0.84433  -0.68455  -0.48175  -0.24869  -0.00000   0.24869 Columns 53 through 65:   0.48175   0.68455   0.84433   0.95106   0.99803   0.98229   0.90483   0.77051   0.58779   0.36812   0.12533  -0.12533  -0.36812 Columns 66 through 78:  -0.58779  -0.77051  -0.90483  -0.98229  -0.99803  -0.95106  -0.84433  -0.68455  -0.48175  -0.24869  -0.00000   0.24869   0.48175 Columns 79 through 81:   0.68455   0.84433   0.951061:   0.78000   0.79000   0.800003. 绘制sin图形>> plot(x,y1)>>

推荐信息