Machine Learning ---- Gradient Descent

news2024/11/15 9:05:47

目录

一、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.coloradmin.cn/o/1528403.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

GPIO和Pinctrl子系统的使用

一、 Pinctrl子系统 1、基本架构 现在的芯片动辄几百个引脚,在使用到GPIO功能时,让你一个引脚一个引脚去找对应的寄存器,说实话很烦。所以,要把引脚的复用、配置抽出来,做成Pinctrl子系统,给GPIO、UART等模…

2082.找单词

动态规划问题: 先声明两个数组: 数组 a:存储当前状态下,所有可能的单词价值总和的计数。在每次迭代开始时,我们使用 a 数组来跟踪包含当前字母之前的所有可能单词的价值总和。 数组 b:在处理每个字母时&a…

XMind for mac/Win:解锁思维新境界,让思维导图成为你的创意引擎

在信息爆炸的时代,如何高效地整理思绪、捕捉灵感,成为每个人都需要面对的挑战。而XMind,作为一款功能强大的思维导图软件,正以其独特的魅力,帮助无数用户解锁思维新境界,让思维导图成为他们的创意引擎。 无…

idea远程试调jar、远程试调war

idea远程试调jar、远程试调war 目的&#xff1a;测试运行时与ide开发时是否一致。 配置jar Maven中添加 <packaging>jar</packaging>将其打包为jar。 设置运行入口main 编译jar 看到jar输出 配置试调 添加jar运行 远程试调 先在源码中打好断点试调 debug运行…

String类型详解

1. Java为何要创造String类 在C语言中,是没有String这个类型的,通常使用字符数组中存放一个个字符,再加上最后一个\0来表示/存放一个字符串.也可以使用一个字符指针指向字符串的首元素,直到遇到\0停止,再加上C语言头文件string.h中封装的函数,对于字符串的操作已经够用了. Java…

Learn OpenGL 18 几何着色器

几何着色器 在顶点和片段着色器之间有一个可选的几何着色器(Geometry Shader)&#xff0c;几何着色器的输入是一个图元&#xff08;如点或三角形&#xff09;的一组顶点。几何着色器可以在顶点发送到下一着色器阶段之前对它们随意变换。然而&#xff0c;几何着色器最有趣的地方…

入门:Vue全家桶都有谁,分别肩负什么责任?

当使用Vue.js开发项目时&#xff0c;通常会使用Vue全家桶来提供完整的开发工具和功能。以下是Vue全家桶的各个部分的详细介绍&#xff1a; 项目构建工具 - Vue-cli&#xff1a; Vue-cli是Vue.js官方提供的脚手架工具&#xff0c;可以快速生成一个Vue.jswebpack的项目模板。它提…

【机器学习-01】机器学习基本概念与建模流程

机器学习的过程本质上是一个不断通过数据训练来提升模型在对应评估指标上表现的过程。在此过程中&#xff0c;为模型提供有效的反馈并基于这些反馈进行持续的调整是至关重要的。只有当这个过程顺利进行时&#xff0c;模型才能得到有效的训练&#xff0c;机器才能真正实现学习。…

nodejs基于vue大学生健身爱好者交流网站flask-django-php

任何系统都要遵循系统设计的基本流程&#xff0c;本系统也不例外&#xff0c;同样需要经过市场调研&#xff0c;需求分析&#xff0c;概要设计&#xff0c;详细设计&#xff0c;编码&#xff0c;测试这些步骤&#xff0c;基于python技术、django/flask框架、B/S机构、Mysql数据…

边缘计算网关能够解决企业数改中哪些问题?-天拓四方

随着工业4.0时代的到来&#xff0c;数字化转型已经成为工业企业发展的必然趋势。在这一过程中&#xff0c;边缘计算网关以其独特的优势&#xff0c;正逐渐成为工业企业实现智能化、高效化运营的关键技术。 边缘计算网关是一种部署在网络边缘的设备&#xff0c;它集成了计算、存…

从自动化到测开,测试人员逆袭之路从此起步!

在当今竞争激烈的软件测试行业中&#xff0c;近期的招聘市场确实面临一些挑战。大量的求职者争相涌入岗位&#xff0c;许多热衷于功能测试的人士甚至难以找到理想的工作机会。更不幸的是&#xff0c;连自动化测试和性能测试这些专业领域也受到了测试开发人员的竞争压力。然而&a…

Linux 常见驱动框架

一、V4L2驱动框架 v4l2驱动框架主要对象&#xff1a; &#xff08;1&#xff09;video_device&#xff1a;一个字符设备&#xff0c;为用户空间提供设备节点(/dev/videox)&#xff0c;提供系统调用的相关操作(open、ioctl…) &#xff08;2&#xff09;v4l2_device&#xff1a…

QT中dumpcpp以及dumpdoc使用

qt中调用COM的方式方法有四种&#xff0c;参考解释在 Qt 中使用 ActiveX 控件和 COM (runebook.dev) 介绍dumpcpp的使用方法Qt - dumpcpp 工具 (ActiveQt) (runebook.dev)&#xff1a; 在安装好了的qt电脑上&#xff0c;通过powershell窗口来实现&#xff0c;powershell比cmd要…

融云:TikTok背水一战,出海应用「用户被遗忘权」保护需升级

TikTok开启全面反击了。 针对美国众议院投票通过法案“强制要求TikTok在165天内剥离母公司字节跳动&#xff0c;否则TikTok将在美国的应用商店下架”这一晴天霹雳&#xff0c;TikTok近日采取了弹窗动员策略&#xff0c;号召用户共同应对挑战。 事实上&#xff0c;从TikTok仅用…

xss.pwnfunction(DOM型XSS)靶场

环境进入该网站 Challenges (pwnfunction.com) 第一关&#xff1a;Ma Spaghet! 源码&#xff1a; <!-- Challenge --> <h2 id"spaghet"></h2> <script>spaghet.innerHTML (new URL(location).searchParams.get(somebody) || "Somebo…

关于大规模电商平台商品数据采集的技术难点分析与批量采集封装API接口

电商数据采集要注意哪些点&#xff1f; 首先是采集平台&#xff0c;是否可以覆盖主流的电商平台&#xff0c;如淘宝、天猫、京东、拼多多等&#xff0c;其次是覆盖程度&#xff0c;是否可对平台中的多个字段进行采集&#xff0c;如价格、销量、促销信息&#xff0c;最后是采集…

实地研究降本增效的杀伤力,LSTM算法实现全国失业率分析预测

前言 ​ 降本增效降本增笑&#xff1f;增不增效暂且不清楚&#xff0c;但是这段时间大厂的产品频繁出现服务器宕机和产品BUG确实是十分增笑。目前来看降本增效这一理念还会不断渗透到各行各业&#xff0c;不单单只是互联网这块了&#xff0c;那么对于目前就业最为严峻的一段时…

Excel xlsx file:not supported

报错信息&#xff1a; 原因&#xff1a; Excel和xlrd版本不匹配 解决措施&#xff1a; 降低xlrd版本或Excel版本 方法一&#xff1a; 1) 先卸载了原来的版本&#xff1a;uninstal xlrd 2) 安装新的低版本xlrd模块pip install xlrd1.2.0 方法二&#xff1a; 1&#xff09…

数据结构之带头双向链表(易学版)

目录 1.问题引入 2.结构实现 2.3.1接口实现 2.3.2函数实现 3.总结 &#xff0c;又和大家见面了&#xff0c;今天要给大家分享的是双链表的知识&#xff0c;跟着我的脚步&#xff0c;包学包会哦~ 规矩不乱&#xff0c;先赞后看&#xff01; ps&#xff1a;&#xff08;孙…

Tortoisegit 免密配置

TortoiseGit的免密配置通常涉及公钥和私钥的使用&#xff0c;以及通过配置来避免在每次操作时需要输入密码。以下是具体的配置步骤&#xff1a; 1、生成私钥&#xff1a; 首先&#xff0c;使用PuTTYgen生成私钥。你可以在“开始”菜单中找到TortoiseGit文件夹&#xff0c;并在…