图解AI数学基础(4) | 微积分与最优化(要点速查清单·完结)

图解AI数学基础:从入门到精通系列教程(要点速查清单·完结) 本系列教程展开讲解AI所需的数学基础知识,力求以最直观最易懂的方式给帮助大家掌握AI依赖的数学知识最小子集。本教程内容覆盖线性代数与矩阵论,概率与统计,信息论,微积分与最优化几个核心的知识板块。...... 阅读详情


1.最优化理论(Optimality Theory)

我们在做事过程中,会希望以最小的代价取得最大的收益。在解决一些工程问题时,人们常会遇到多种因素交织在一起与决策目标相互影响的情况;我们会使用最优化数学理论来应对这一挑战,而大家了解的线性规划也是最早的最优化方法之一。

最优化问题Optimization Problems

李航博士的《统计学习方法》将机器学习总结为:机器学习 = 模型 + 策略 + 算法。而公式中的算法指的就是优化算法。大家在算法求职面试过程中,在项目模型效果调优过程中,都经常会遇到优化算法,它是学习AI必备的数学知识。

2.最优化问题的数学描述

最优化的基本数学模型如下公式所示:

min ⁡ f ( x )  s.t.  h i ( x ) = 0 g j ( x ) ⩽ 0 \begin{aligned} \min & f(\mathbf{x}) \\ \text { s.t. } & h_{i}(\mathbf{x})=0 \\ & g_{j}(\mathbf{x}) \leqslant 0 \end{aligned} min s.t. ​f(x)hi​(x)=0gj​(x)⩽0​

它有三个基本要素,即:

  • 设计变量: x \bold{x} x 是一个实数域范围内的 n n n维向量,被称为决策变量或问题的解;
  • 目标函数: f ( x ) f(x) f(x) 为目标函数;
  • 约束条件: h i ( x ) = 0 h_{i} (x) =0 hi​(x)=0 称为等式约束, g j ( x ) ≤ 0 g_{j}(x) \leq 0 gj​(x)≤0 为不等式约束, i , j = 0 , 1 , 2 , … i,j=0,1,2,\dots i,j=0,1,2,…

3.凸集与凸集分离定理

1)凸集(Convex Set)

实数域 R R R 上(或复数 C C C 上)的向量空间中,如果集合 S S S 中任两点的连线上的点都在 S S S 内,则称集合 S S S 为凸集。

凸集Convex Set

设集合 S ⊂ R n S \subset R^{n} S⊂Rn,若对于任意两点 x , y ∈ S x, y \in S x,y∈S,及实数 λ ( 0 ≤ λ ≤ 1 ) \lambda ( 0 \leq \lambda \leq 1) λ(0≤λ≤1) 都有: λ x + ( 1 − λ ) y ∈ S \lambda x+(1-\lambda) y \in S λx+(1−λ)y∈S 则称集合 S \mathrm{S} S 为凸集。

2)超平面和半空间

实际上,二维空间的超平面就是一条线(可以使曲线),三维空间的超平面就是一个面(可以是曲面)。其数学表达式如下:

超平面: H = { x ∈ R n ∣ a 1 + a 2 + … + a n = b } H=\{x \in R^{n} \mid a_{1}+a_{2}+\ldots+a_{n}=b\} H={ x∈Rn∣a1​+a2​+…+an​=b}

半空间: H + = { x ∈ R n ∣ a 1 + a 2 + … + a n ≥ b } H^{+}=\{x \in R^{n} \mid a_{1}+a_{2}+\ldots+a_{n} \geq b\} H+={ x∈Rn∣a1​+a2​+…+an​≥b}

3)凸集分离定理(Hyperplane Separation Theorem)

所谓两个凸集分离,直观地看是指两个凸集合没有交叉和重合的部分,因此可以用一张超平面将两者隔在两边,如图所示。

凸集分离定理Hyperplane Separation Theorem

4)凸函数(Convex Function)

凸函数就是一个定义域在某个向量空间的凸子集 C C C 上的实值函数。

凸函数 Convex Function

数学定义为:对于函数 f ( x ) f(x) f(x),如果其定义域 C C C 是凸的,且对于 ∀ x 1 , x 2 ∈ C \forall x_{1},x_{2}∈C ∀x1​,x2​∈C, 0 ≤ t ≤ 1 0\leq t \leq 1 0≤t≤1,有: f ( t x 1 + ( 1 − t ) x 2 ) ≤ t f ( x 1 ) + ( 1 − t ) f ( x 2 ) f(t x_{1}+(1- t) x_{2}) \leq t f(x_{1}) +(1- t) f(x_{2}) f(tx1​+(1−t)x2​)≤tf(x1​)+(1−t)f(x2​),则 f ( x ) f(x) f(x) 是凸函数。

注:如果一个函数是凸函数,则其局部最优点就是它的全局最优点。这个性质在机器学习算法优化中有很重要的应用,因为机器学习模型最后就是在求某个函数的全局最优点,一旦证明该函数(机器学习里面叫『损失函数』)是凸函数,那相当于我们只用求它的局部最优点了。

4.梯度下降算法(Gradient Descent Algorithm)

1)背景

计算机在运用迭代法做数值计算(比如求解某个方程组的解)时,只要误差能够收敛,计算机最后经过一定次数的迭代后是可以给出一个跟真实解很接近的结果的。

其中有一个非常核心的问题,如果我们得到的目标函数是非线性的情况下,按照哪个方向迭代求解误差的收敛速度会最快呢?答案就是沿梯度方向。

这就引入了我们的梯度下降法。

2)梯度下降法

在多元微分学中,梯度就是函数的导数方向。梯度法是求解无约束多元函数极值最早的数值方法,很多机器学习的常用算法都是以它作为算法框架,进行改进而导出更为复杂的优化方法。

在求解目标函数 f ( x ) f(x) f(x) 的最小值时,为求得目标函数的一个凸函数,在最优化方法中被表示为:

min ⁡ f ( x ) \min f(x) minf(x)

梯度下降算法 Gradient Descent Algorithm

根据导数的定义,函数 f ( x ) f(x) f(x) 的导函数就是目标函数在 x x x 上的变化率。在多元的情况下,目标函数 f ( x , y , z ) f(x, y, z) f(x,y,z) 在某点的梯度 grad ⁡ f ( x , y , z ) = ( ∂ f ∂ x , ∂ f ∂ y , ∂ f ∂ z ) \operatorname{grad}f(x, y, z)=(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}) gradf(x,y,z)=(∂x∂f​,∂y∂f​,∂z∂f​) 是一个由各个分量的偏导数构成的向量,负梯度方向是 f ( x , y , z ) f(x, y, z) f(x,y,z) 减小最快的方向。

如上图所示,当需要求 f ( x ) f(x) f(x) 的最小值时(机器学习中的 f ( x ) f(x) f(x) 一般就是损失函数,而我们的目标就是希望损失函数最小化),我们就可以先任意选取一个函数的初始点 x 0 x_{0} x0​ (三维情况就是 ( x 0 , y 0 , z 0 ) (x_{0}, y_{0}, z_{0})

漫画+图解 7天搞定微积分 书籍pdf 书籍低价大放送,,, 立即下载

相关推荐

电商数据分析19——数据分析在电商平台价格弹性研究中的应用

价格弹性是一个衡量产品价格变化对销量影响的经济学指标,对于电商平台而言,深入理解和有效运用价格弹性,对于制定竞争策略、优化产品定价具有重要意义。随着大数据时代的到来,通过数据分析研究产品的价格弹性,成为了电商企业制定价格策略、调整市场定位、优化促销活动的重要依据。

theskylife的博客 2836

gephi生成网络关系图_路网拓扑重建专题 (3) 网络图生成

城市道路网建模在获得基础路网之后,需要考虑道路交通网络的描述与表达问题。网络是将现实世界中的事物及其关系进行适当的抽象,构造成由节点和边按照一定规则组成的形式。一个实体网络可以由有限个“节点”集合与“边”集合构成的图表示,即网络表示为。对于一个由个节点组成的无权复杂网络,该图有邻接矩阵,这里。根据研究对象不同,建模方法主要包括原始法[1]和对偶法[2]两种,见图1,字母a-j为交叉口编号...

weixin_39761195的博客 3504

邮件伪造和SPF

之前看了下邮件伪造觉得挺有意思的,所以看了下邮件伪造的东西,下面简单的总结了一下,如果有不妥的地方还望大佬们提出来。 1. 什么是SPF SPF是 Sender Policy Framework 的缩写,一种以IP地址认证电子邮件发件人身份的技术,是为了防范垃圾邮件而提出来的一种DNS记录类型,它是一种TXT类型的记录。 接收邮件方会首先检查域名的SPF记录,来确定发件人的IP地址是否被包含在SP...

SunJ3t的菠萝屋 2449

SAP开发实战:用FI_DOCUMENT_CHANGE BAPI批量修改FB03凭证抬头和行项目文本(附完整ABAP代码)

本文详细介绍了如何使用SAP的FI_DOCUMENT_CHANGE BAPI批量修改FB03凭证抬头和行项目文本,提供完整的ABAP代码实现方案。通过该BAPI,开发者可以高效完成财务凭证的批量修改,确保数据一致性和审计合规性,显著提升SAP财务模块的运维效率。

weixin_29224589的博客 384

yanshee 机器人全流程指南

2.点击yanshee app右上角根据提示操作 3.当手机显示成功连接 ,按下机器人胸前按钮说出“ip地址”4.根据机器人播报的ip地址加上:8888使用浏览器访问,你就会看到 jupyterd的界面,里面可以新建文件也可以改他存在的文件。我们使了yanshee机器人,这个是面向K12、中高职、高校学生推出的开源人形机器人教育平台,应用于课程教学、竞赛、科研活动等场景。我们接下来可以根据这些apl做许多好玩的,比如控制他运动,跳舞唱歌,it`s easy。注意电脑,手机,机器人必须连同一个网。

qq_44827929的博客 7616

智能手环嵌入式系统:STM32+ESP8266多传感器健康监护设计

可穿戴健康监测设备是物联网与边缘计算融合的典型应用,其核心在于多源生理信号采集、低功耗实时处理及安全云协同。基于光电容积脉搏波(PPG)的心率与血氧检测、NTC热敏电阻体温测量、加速度-角速度融合跌倒判据等技术,构成了老年健康监护的基础感知能力;而STM32主控与ESP8266协处理器分工架构,则实现了计算资源与通信负载的高效解耦。该方案依托FreeRTOS多任务调度、阿里云IoT物模型标准化交互及MQTT双向通信,兼顾实时性、可靠性和工程可维护性,广泛适用于居家养老、慢病管理与远程健康预警等场景。

weixin_33256096的博客 100

基于LSTM算法实现交通流量预测(Pytorch版)

本研究采用PyTorch框架,设计并实现了一种基于LSTM(Long Short-Term Memory)网络的交通流量预测模型。针对时序性显著的交通流量数据,模型首先将多节点、多通道的时空信息整合为一维特征输入至多层LSTM单元,利用其捕捉长期依赖及短期波动的能力进行深度学习。全连接层随后调整时间步长以适应预测周期需求。模型结构灵活,能适应不同节点数、输入输出长度及通道配置,实现在给定历史流量数据基础上对未来交通流量的精准预测,为交通管理与规划提供数据驱动支持。

打酱油的葫芦娃 4641

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

上一篇: 图解AI数学基础:从入门到精通系列教程(要点速查清单·完结)
下一篇: 图解AI数学基础(1) | 线性代数与矩阵论(要点速查清单·完结)
ShowMeAI
博客等级 码龄5年 6514粉丝 672原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ShowMeAI

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值