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.kler.cn/a/273758.html

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

相关文章

万界星空科技WMS仓储管理包含哪些具体内容?

wms仓库管理是通过入库业务、出库业务、仓库调拨、库存调拨和虚仓管理等功能,综合批次管理、物料对应、库存盘点、质检管理、虚仓管理和即时库存管理等功能综合运用的管理系统,有效控制并跟踪仓库业务的物流和成本管理全过程,实现完善的企业仓…

如何系统地自学 Python?

目录 Python 数据类型 控制结构 函数和模块 文件操作 异常处理 类和对象 列表推导式和生成器 匿名函数和高阶函数 面向对象编程 总结 Python Python是一种面向对象、解释型计算机程序设计语言,由Guido van Rossum于1989年发明,第一个公开发行…

【iOS】Blocks

文章目录 前言一、什么是Blocks二、Blocks模式1.Block语法2.Block类型变量3.截获自动变量值4.__block说明符5.截获的自动变量 三、Blocks的实现1.Block的实质__main_block_impl_0Block对象的实现结构体初始化 2.截获自动变量值3.__block说明符4.Block存储域5.__block变量存储域…

C#进阶实践项目(俄罗斯方块)

CSharp进阶实践项目--俄罗斯方块 1.需求分析 2.复用贪吃蛇开始等场景切换的代码 (自己写一遍,不难!!!) 入口: 更新接口: Game 类: BeginOrEndBaseScene 类:…

Ubuntu使用Docker部署Nginx容器并结合内网穿透实现公网访问本地服务

目录 ⛳️推荐 1. 安装Docker 2. 使用Docker拉取Nginx镜像 3. 创建并启动Nginx容器 4. 本地连接测试 5. 公网远程访问本地Nginx 5.1 内网穿透工具安装 5.2 创建远程连接公网地址 5.3 使用固定公网地址远程访问 ⛳️推荐 前些天发现了一个巨牛的人工智能学习网站&#…

云原生 PaaS 服务:构建现代应用的利器(分布式应用服务、配置中心、数据库服务、定时任务、实时监控、服务网关、技术组件)

在当今数字化时代,企业需要面对不断变化的市场需求和竞争压力,以及日益复杂的应用开发和部署挑战。在这样的背景下,云原生 PaaS(Platform as a Service)服务应运而生,为企业提供了一种现代化的应用开发和部…

【备忘录】查询数据库中是否存在数据 的SQL语句性能对比和优化

原作者:码农Academy 原文地址 文章目录 引言COUNT()函数的局限性EXISTS子句的优势LIMIT 1 优势适用场景总结 在仅仅需要判断数据库中是否存在满足特定条件的记录时,使用EXISTS子句或带有LIMIT 1的查询不仅能够提高查询效率,减少资源消耗&…

IDEA中的Project工程、Module模块的概念及创建导入

1、IDEA中的层级关系: project(工程) - module(模块) - package(包) - class(类)/接口具体的: 一个project中可以创建多个module一个module中可以创建多个package一个package中可以创建多个class/接口2、Project和Module的概念: 在 IntelliJ …

初次文件包含漏洞

1.文件包含漏洞介绍 1.1.文件包含漏洞解释   文件包含漏洞就是使用函数去包含任意文件的时候,当包含的文件来源过滤不严谨的时候,当存在包含恶意文件后,就可以通过这个恶意的文件来达到相应的目的。 1.2.文件包含漏洞原理    其实原理就…

使用ansible剧本进行lvm分盘

使用 Ansible 剧本(Playbook)进行 LVM 分区管理是一种自动化的方式,可以帮助管理员在多台主机上批量管理逻辑卷。 部署环境 3台主机,添加硬盘 ansible-galaxy collection install community.general 联网执行,下…

phpStudy安装thinkCMF8时,如何解决服务器rewrite和APIrewrite不支持的问题

解决步骤: 一:服务器rewrite 点击后面的问号跳转到官方文档链接: 复制红框内的代码 打开phpstudy,找到配置的站点,点击管理,找到伪静态 点击确认保存即可。 phpstudy会自动重启站点。 此时,…

Java后端面试:框架篇高频面试(Spring、SpringMVC、SpringBoot、MyBatis)

👨‍🎓作者简介:一位大四、研0学生,正在努力准备大四暑假的实习 🌌上期文章:Java后端面试:MySQL面试篇(底层事务、SQL调优) 📚订阅专栏:Java后端面…

【渗透工具】BurpSuite汉化无cmd框版安装教程

【本文仅记录个人安装过程,教程来自:https://www.52pojie.cn/thread-1544866-1-1.html】 安装链接 123网盘(不限速 需登录 免客户端 ) https://www.123pan.com/s/F2W5Vv-Rk7Vv.html提取码:52pj 安装步骤 选择所需安装的版本&…

Flutter-自定义图片3D画廊

效果 需求 3D画廊效果 设计内容 StackGestureDetectorTransformPositioned数学三角函数 代码实现 具体代码大概300行 import dart:math;import package:flutter/material.dart; import package:flutter_xy/widgets/xy_app_bar.dart;import ../../r.dart;class ImageSwitc…

蓝桥杯刷题总结(Python组)

1、蛇形矩阵 解题思路:每次赋值后都对方向进行改变,一般上下左右就是(-1,0),(0,1),(1,0),(0&…

信雅纳网络测试的二次开发集成:XOA(Xena Open-Source Automation)开源自动化测试

目录 XOA是什么 XOA CLI XOA Python API ​XOA Python Test Suite/测试套件 XOA Converter Source Code XOA是什么 XOA(Xena Open-Source Automation)是一个开源的测试自动化框架,追求“高效、易用、灵活”的跨操作系统的开发框架。能…

目标检测——YOLOv5算法解读

作者:UltralyticsLLC公司 代码:https://github.com/ultralytics/yolov5 YOLO系列算法解读: YOLOv1通俗易懂版解读SSD算法解读YOLOv2算法解读YOLOv3算法解读YOLOv4算法解读YOLOv5算法解读 PP-YOLO系列算法解读: PP-YOLO算法解读…

高架学习笔记之信息系统分类概览

目录 零、前言 一、业务处理系统(TPS) 概念 功能 特点 二、管理信息系统(MIS) 概念 功能 组成 三、决策支持系统(DSS) 概念 功能 特点 组成 1. 数据仓库 2. 数据挖掘工具 3. 决策模型 4. 可视化界面 四、专家系统(ES) 概念 特点 组成 求解过程 专家系统…

爬虫技术实战案例解析

目录 前言 案例背景 案例实现 案例总结 结语 前言 作者简介: 懒大王敲代码,计算机专业应届生 今天给大家聊聊爬虫技术实战案例解析,希望大家能觉得实用! 欢迎大家点赞 👍 收藏 ⭐ 加关注哦!&#x1…

超分之SwinIR

SwinIR: Image restoration using Swin TransformerSwinIR: 使用Swin Transformer 进行图像恢复Liang J, Cao J, Sun G, et al.Proceedings of the IEEE/CVF international conference on computer vision. 2021: 1833-1844. 摘要 首先,介绍了Image restoration的含…
最新文章