Machine Learning ---- Gradient Descent

目录

一、The concept of gradient:

       ① In a univariate function:

       ②In multivariate functions:

二、Introduction of gradient descent cases:

三、Gradient descent formula and its simple understanding:

四、Formula operation precautions:


一、The concept of gradient:

       ① In a univariate function

        gradient is actually the differentiation of the function, representing the slope of the tangent of the function at a given point

       ②In multivariate functions

        a gradient is a vector with a direction, and the direction of the gradient indicates the direction in which the function rises the fastest at a given point

二、Introduction of gradient descent cases:

       Do you remember the golf course inside the cat and mouse? It looks like this in the animation:

        Let's take a look at these two pictures. You can easily see the distant hill, right? We can take it as the most typical example, and the golf course can also be abstracted into a coordinate map:

        So in this coordinate, we will correspond the following (x, y) to (w, b) respectively. Then, when J (w, b) is at its maximum, which is the peak in the red area of the graph, we start the gradient descent process.

        Firstly, we rotate one circle from the highest point to find the direction with the highest slope. At this point, we can take a small step down. The reason for choosing this direction is actually because it is the steepest direction. If we walk down the same step length, the height of descent will naturally be the highest, and we can also walk faster to the lowest point (local minimum point). At the same time, after each step, we look around and choose. Finally, we can determine this path:Finally reaching the local minimum point A, is this the only minimum point? Of course not:

        It is also possible to reach point B, which is also a local minimum point. At this point, we have introduced the implementation process of gradient descent, and we will further understand its meaning through mathematical formulas.

三、Gradient descent formula and its simple understanding:

        We first provide the formula for gradient descent:

w = w - \alpha \frac{ \partial J(w,b) }{ \partial w }

b = b - \alpha \frac{ \partial J(w,b) }{ \partial b }

        In the formula, \alpha corresponds to what we call the learning rate, and the equal sign is the same as the assignment symbol in computer program code. J (w, b) can be found in the regression equation blog in the previous section. As for the determination of the learning rate, we will share it with you next time. Here, we will first understand the meaning of the formula:

        Firstly, let's simplify the formula and take b equal to 0 as an example. This way, we can better understand its meaning through a two-dimensional Cartesian coordinate system:

        In this J (w, b) coordinate graph, which is a quadratic function, since we consider b in the equation to be 0,So we can assume that \frac{ \partial J(w,b) }{ \partial w } = \frac{ \partial J(w) }{ \partial w },So, such a partial derivative can be seen as the derivative in the unary case. At this point, it can be seen that when \alpha>0 and the corresponding w value is in the right half, the derivative is positive, that is, its slope is positive. This is equivalent to subtracting a positive number from w, and its w point will move to the left, which is the closest to its minimum value, which is the optimal solution. Similarly, when in the left half of the function, its w will move to the right, which is close to the minimum value, So the step size for each movement is \alpha.

        This is a simple understanding of the gradient descent formula.


四、Formula operation precautions:

        This is a simple understanding of the gradient descent formula

        just like this:

temp_w = w - \alpha \frac{ \partial J(w,b) }{ \partial w }

temp_b = b - \alpha \frac{ \partial J(w,b) }{ \partial b }

w = temp_w

b = temp_b

        The following is an incorrect order of operations that should be avoided:

temp_w = w - \alpha \frac{ \partial J(w,b) }{ \partial w }

w = temp_w

temp_b = b - \alpha \frac{ \partial J(w,b) }{ \partial b }

b = temp_b

        This is the understanding of the formula and algorithm implementation for gradient descent. As for the code implementation, we will continue to explain it in future articles.

        Machine Learning ---- Cost function-CSDN博客

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/468541.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

RocketMQ源码分析

文章目录 一、简介二、NameServer的启动过程三、Broker的启动过程四、Netty服务注册框架(Netty框架使用的一个很好的案例)五、Broker心跳注册过程六、Producer发送消息流程七、Consumer拉取消息的流程八、文件存储九、长轮询消息 RocketMQ源码分析基于版…

苍穹外卖-day15:套餐管理

套餐管理 课程内容 套餐分页查询启售停售套餐删除套餐新增套餐 1. 套餐分页查询 1.1 需求分析和接口设计 根据产品原型来了解需求,套餐分页查询的产品原型如下: 业务规则: 根据页码展示套餐信息(套餐名称、套餐图片、套餐分类、价格、售…

大数据管理平台建设方案书

1.1.系统概述 1.1.1需求描述 1.1.2.需求分析 1.1.3.重难点分析 1.1.4.重难点解决措施 1.2.系统架构设计 1.2.1.系统架构图 1.2.2.关键技术 软件开发全资料获取进主页。

【贪心算法】Leetcode 55. 跳跃游戏 45. 跳跃游戏 I

【贪心算法】Leetcode 55. 跳跃游戏 45. 跳跃游戏 II Leetcode 55. 跳跃游戏解法1 贪心 Leetcode 45. 跳跃游戏I解法 贪心 Leetcode 55. 跳跃游戏 ---------------🎈🎈55. 跳跃游戏 题目链接🎈🎈------------------- 解法1 贪心…

【Python循环4/5】跳出循环的办法

目录 导入 break 具体用法 在for循环中的运用 在while循环中的运用 continue 具体用法 区别 总结 导入 前几天的博文里,我们学习了for循环和while循环。 无论是for循环还是while循环,默认的终止条件都是边界条件。在触发边界条件之前&am…

【Ubuntu】FTP站点搭建

配置顺序 前提条件:确保软件仓库可以正常使用,确保已正常配置IP地址 1.安装FTP服务 2.编辑FTP配置文件 3.设置开机自启 4.创建用户 5.配置用户限制名单 6.重启服务 7.查看运行状态 8.测试在同一局域网下的Windows查看文件 1.安装FTP服务 sudo apt insta…

大广赛获奖作品分享:平面设计精选!

全国大学生广告艺术大赛:简称大广赛,是中国最大的高校广告艺术传播平台,是由教育部高等教育司指导、中国高等教育学会广告教育专业委员会主办的全国性高校文科大赛。大广赛旨在提高大学生的创新精神和实践能力,激发大学生的创意灵…

如何查看MySQL数据库的连接数

连接数是指用户已经创建多少个连接,也就是MySQL中通过执行 SHOW PROCESSLIST命令输出数据库中运行着的线程个数的详情,如图6-1-1所示。 SHOW PROCESSLIST默认情况下只显示前100条记录的详情,如果需要显示超过100条的所有记录,可以…

qt使用Windows经典风格,以使QTreeView或QTreeWidge有节点线或加号

没有使用Windows经典风格的QTreeView或QTreeWidget显示如下: 使用Windows经典风格的QTreeView或QTreeWidget显示如下: 树展开时: 树未展开时: 可以看到: 未使用Windows经典风格时,QTreeView或QTreeWidget…

RealBasicVSR使用记录

对各种场景图片、视频超分结果都很不错的模型。 paper:https://arxiv.org/pdf/2111.12704.pdf code:https://github.com/ckkelvinchan/RealBasicVSR 一、使用步骤 1. git clone https://github.com/ckkelvinchan/RealBasicVSR.git 2. 我的环境已安装…

AJAX——综合案例

1 Bootstrap弹框 功能&#xff1a;不离开当前页面&#xff0c;显示单独内容&#xff0c;供用户操作 步骤&#xff1a; 引入bootstrap.css和bootstrap.js准备弹框标签&#xff0c;确认结构通过自定义属性&#xff0c;控制弹框的显示和隐藏 <!DOCTYPE html> <html la…

阿里云优惠券是什么?如何领取阿里云优惠券?

阿里云作为国内领先的云计算服务提供商&#xff0c;为广大用户提供了丰富的云产品和解决方案。为了吸引用户上云&#xff0c;阿里云经常推出各种优惠活动&#xff0c;其中最受用户欢迎的就是阿里云优惠券。那么&#xff0c;阿里云优惠券究竟是什么呢&#xff1f;我们又该如何领…

面经Java开发

联奕一面: 1、这段代码的输出结果是多少?t q z package com.smart.community.test;public class Test {public class B{static {System.out.println("t");}public B(){System.out.println("z");}}public class A extends B{static {System.out.println…

数据结构——lesson10排序之插入排序

&#x1f49e;&#x1f49e; 前言 hello hello~ &#xff0c;这里是大耳朵土土垚~&#x1f496;&#x1f496; &#xff0c;欢迎大家点赞&#x1f973;&#x1f973;关注&#x1f4a5;&#x1f4a5;收藏&#x1f339;&#x1f339;&#x1f339; &#x1f4a5;个人主页&#x…

语文新读写杂志语文新读写杂志社语文新读写编辑部2023年第18期目录

视点_名作鉴赏 新年醉话《语文新读写》投稿&#xff1a;cn7kantougao163.com 老舍; 1 那些年&#xff0c;唐朝人一起喝过的酒 章雪峰; 2-5 酒德颂 刘伶; 5 刘伶病酒 刘义庆; 6 将进酒 李白; 7 把酒问月 李白; 8 哭宣城善酿纪叟 李白; 9 饮中八…

login登录界面

展示情况 代码&#xff1a; <template><div class"wrapper"><div style"margin: 200px auto; background-color: #fff; width: 350px; height: 300px; padding: 20px; border-radius: 10px"> <div style"margin: 20px 0; text…

基于spring boot框架的发艺美发店管理系统

摘 要 系统根据现有的管理模块进行开发和扩展&#xff0c;采用面向对象的开发的思想和结构化的开发方法对发艺美发店管理的现状进行系统调查。采用结构化的分析设计&#xff0c;该方法要求结合一定的图表&#xff0c;在模块化的基础上进行系统的开发工作。在设计中采用“自下而…

熵、交叉熵、KL散度【详细理论推导】

机器学习笔记 第一章 机器学习简介 第二章 感知机 第三章 支持向量机 第四章 朴素贝叶斯分类器 第五章 Logistic回归 第六章 线性回归和岭回归 第七章 多层感知机与反向传播【Python实例】 第八章 主成分分析【PCA降维】 第九章 隐马尔可夫模型 第十章 奇异值分解 提示&#x…

【机器学习-05】模型的评估与选择

在前面【机器学习-01】机器学习基本概念与建模流程的文章中我们已经知道了机器学习的一些基本概念和模型构建的流程&#xff0c;本章我们将介绍模型训练出来后如何对模型进行评估和选择等 1、 误差与过拟合 学习器对样本的实际预测结果与真实值之间的差异&#xff0c;我们称之…

最新2024年阿里云服务器地域和可用区全球分布表

2024年最新阿里云服务器地域分布表&#xff0c;地域指数据中心所在的地理区域&#xff0c;通常按照数据中心所在的城市划分&#xff0c;例如华北2&#xff08;北京&#xff09;地域表示数据中心所在的城市是北京。阿里云地域分为四部分即中国、亚太其他国家、欧洲与美洲和中东&…
最新文章