Machine Learning ---- Multiple linear regression equation

news2024/10/7 16:25:51

一、Multiple linear regression:

        In the study of real-world problems, the changes in the dependent variable are often influenced by several important factors. In this case, it is necessary to use two or more influencing factors as independent variables to explain the changes in the dependent variable. This is known as multiple regression, also known as multiple regression. When there is a linear relationship between multiple independent variables and the dependent variable, the regression analysis conducted is called multiple linear regression.

        Let's first review its univariate linear regression equation:

 f(x_i) = wx_i + b

        So, for its multiple linear regression equation, we only need to transform w and x in it:

f_{\vec{w},b}(\vec{x}) = \vec{w}_i\vec{x}_i + b

        each of \vec{w}_i and \vec{x}_iis a set of vectors,b is a number。

二、Deeply understand:

        within this function,\vec{x}_i = [x_1,x_2.....x_i] , \vec{w}_i = [w_1,w_2.....w_i] ,the standard expansion formula is:

f_{\vec{w},b}(\vec{x}) = \vec{w}_1\vec{x}_1 + \vec{w}_2\vec{x}_2 + \vec{w}_3\vec{x}_3 + ...... + \vec{w}_i\vec{x}_i + b

        That is, the impact of number of i factors on the variable:

        We observe x_i through a table

x_1x_2x_3f(w,b)
1231331222
1623673215

        Each row corresponds to x is a dataset, and each column represents the corresponding influencing factors.

三、Vectorization processing:

       For this function:

f_{\vec{w},b}(\vec{x}) = \vec{w}_1\vec{x}_1 + \vec{w}_2\vec{x}_2 + \vec{w}_3\vec{x}_3 + ...... + \vec{w}_i\vec{x}_i + b

       We transformed it into

f_{\vec{w},b}(\vec{x}) = \vec{w}_i\vec{x}_i + b

     So in the program, what kind of implementation do we use and what are the differences?

    Firstly, when n is not large, we can traverse:

w = np.array([1.0,2.5,-3,3])
b = 4
x = np.array([10,20,30])

f = w[0]*b[0] + w[1]*b[1] + w[2]*b[2] + b

        Then, using the for loop method

f = 0
for j in range(0,n):
    f = f + w[j] * x[j]
f = f + b

        Finally, we can use the Numpy library:

f = np.dot(w,x) + b

       Among the above three methods, it is particularly recommended to use the last one, as the Numpy function can utilize hardware parallel operations. When n is large, the difference in computation speed is particularly significant.

四、Gradient descent in multiple linear regression:

        The gradient descent operation in multiple linear regression is:

        repeat_(

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

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

..........

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

        )

        If the J (w, b) function is introduced, each expression of w is equal to:

w_i = w_i - a\frac{1}{m}\sum_{j = 1}^{m} f_{\vec{w},b}(x^{(i)} - y^{(i)}) * x^{(i)}

       Its points of attention and understanding are the same as Univariate linear regression equation。

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

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

相关文章

如何用Selenium通过Xpath,精准定位到“多个相同属性值以及多个相同元素”中的目标属性值

前言 本文是该专栏的第21篇,后面会持续分享python爬虫干货知识,记得关注。 相信很多同学,都有使用selenium来写爬虫项目或者自动化页面操作项目。同样,也相信很多同学在使用selenium来定位目标元素的时候,或多或少遇见到这样的情况,就是用Xpath定位目标元素的时候,页面…

AI系统性学习01- Prompt Engineering

文章目录 面向开发者的Prompt Engineering一、简介二、Prompt设计原则1 环境配置2.两个基本原则2.1 原则1:编写清晰、具体的指令2.1.1 策略一:分割2.1.2 策略2:结构化输出2.1.3 策略3:模型检测2.1.4 策略4:提供示例 2.…

Godot 学习笔记(1):环境配置

文章目录 前言Godot 环境配置相关链接最简单的按钮项目Sence打包最简单的按钮事件 总结 前言 我从小就有个梦想,我想做游戏。虽然我大学的时候选择了计算机,工作也是计算机,但是我一直没有时间去学游戏引擎。原因有二:第一&#…

学习数据结构和算法的第16天

单链表的实现 链表的基本结构 #pragma once #include<stdio.h> #include<stlib.h> typedf int SLTDataType; typedy struct SListNode {SLTDataType data;struct SListNode*next; }SLTNode;void Slisprint(SLTNode*phead); void SListPushBack(SLTNode**pphead,S…

常用芯片学习——DS3231M芯片

DS3231M RTC实时时钟 芯片介绍 DS3231M是一款低成本、极其精确的 I2C 实时时钟 &#xff08;RTC&#xff09;。该设备集成了电池输入&#xff0c;并在设备主电源中断时保持准确的计时。微型电子机械系统 &#xff08;MEMS&#xff09; 谐振器的集成提高了器件的长期精度&…

【记录搭建elk 如何在linux共享文件】

『如何在linux共享文件 &#xff0c;搭建elk直接看第二部分』 新增用户a b c adduser a adduser b adduser c新增用户组 A groupadd developteam将用户a b c 加入 组 usermod -a -G developteam hadoop usermod -a -G developteam hbase usermod -a -G developteam hive设置um…

Flutter 核心原理 - UI 框架(UI Framework)

Flutter 既能保证很高的开发效率&#xff0c;又能获得很好的性能。 这两年 Flutter 技术热度持续提高&#xff0c;整个 Flutter 生态和社区也发生了翻天覆地的变化。目前Flutter 稳定版发布到了3.0&#xff0c;现在已经支持移动端、Web端和PC端&#xff0c;通过Flutter 开发的…

【计算机视觉】二、图像形成——实验:2D变换编辑器2.0(Pygame)

文章目录 一、向量和矩阵的基本运算二、几何基元和变换1、几何基元(Geometric Primitives)2、几何变换(Geometric Transformations)2D变换编辑器0. 项目结构1. Package: guibutton.pywindow.py1. __init__(self, width, height, title)2. add_buttons(self)3. clear(self)4. dr…

WEB前端 HTML 列表表格

列表 有序列表 使用“ol”创建“有序列表”&#xff0c;使用“li”表示“列表项” <body><ol type"1"><li>列表1</li><li>列表2</li><li>列表3</li></ol><ol type"A"><li>列表A<…

Redis进阶——redis消息队列

目录 redis消息队列认识消息队列基于List实现消息队列如何基于List结构模拟消息队列基于List的消息队列有哪些优缺点&#xff1f; 基于PubSub的消息队列基于Stream的消息队列读取消息的方式之一&#xff1a;XREAD基于Stream的消息队列–消费者组redis三种消息队列的对比 Stream…

Spring炼气之路(炼气二层)

一、bean的配置 1.1 bean的基础配置 id&#xff1a; bean的id&#xff0c;使用容器可以通过id值获取对应的bean&#xff0c;在一个容器中id值唯一 class&#xff1a; bean的类型&#xff0c;即配置的bean的全路径类名 <bean id"bookDao" class "com.zhang…

Java八股文(MyBatis Plus)

Java八股文のMyBatis Plus MyBatis Plus MyBatis Plus MyBatis Plus 是什么&#xff1f;它与 MyBatis 有什么区别&#xff1f; MyBatis Plus 是基于 MyBatis 进行扩展的一款持久层框架&#xff0c;它提供了一系列增强功能&#xff0c;简化了 MyBatis 的使用。 与 MyBatis 相比…

(十八)【Jmeter】取样器(Sampler)之BeanShell 取样器

简述 操作路径如下: 作用:通过Beanshell脚本来编写自定义请求。配置:编写Beanshell脚本代码,实现请求逻辑。使用场景:在JMeter中利用Beanshell脚本语言的特性进行自定义请求。优点:可以利用Beanshell脚本语言的丰富功能。缺点:脚本语言的性能可能不如其他编译语言,且…

论文阅读——SpectralGPT

SpectralGPT: Spectral Foundation Model SpectralGPT的通用RS基础模型&#xff0c;该模型专门用于使用新型3D生成预训练Transformer&#xff08;GPT&#xff09;处理光谱RS图像。 重建损失由两个部分组成&#xff1a;令牌到令牌和频谱到频谱 下游任务&#xff1a;

Linux进程管理:(六)SMP负载均衡

文章说明&#xff1a; Linux内核版本&#xff1a;5.0 架构&#xff1a;ARM64 参考资料及图片来源&#xff1a;《奔跑吧Linux内核》 Linux 5.0内核源码注释仓库地址&#xff1a; zhangzihengya/LinuxSourceCode_v5.0_study (github.com) 1. 前置知识 1.1 CPU管理位图 内核…

使用Java Runtime执行docker下的mysqldump

Runtime直接使用 docker exec mysql mysqldump -u%s -p%s cblog > %s&#xff08;%s是需要填充的数据&#xff09;&#xff0c;命令无法执行并且不会报错&#xff0c;需要使用字符串数组加入"sh", “-c”&#xff0c;具体代码示例&#xff1a; /*** MySQL数据备份…

无线局域网——wlan

目录 一.wlan的含义和发展 二.wlan技术带来的挑战 1.企业办公场景多样 2.位置速度的要求 3.安全的要求 4.规范的挑战 三.家庭和企业不同的部署需求 1.胖AP模式组网 2.AC瘦AP模式组网 3.组网模式的不同 四.三层隧道转发实验 1.拓扑 2.AP上线 核心交换机vlan ​编辑…

Magical Combat VFX

这个包包含30个可供游戏使用的VFX,有各种口味,为您的游戏增添趣味! 所有VFX都经过了很好的优化,可以在所有平台上使用。 这个包特别有一堆闪电魔法,有两种主要的变体,一种是深色的,另一种是浅色的。但它也提供了一系列其他视觉效果,如神圣咒语、音乐主题等等! 我们提供…

解决谷歌浏览器最新chrome94版本CORS跨域问题

项目场景&#xff1a; 谷歌浏览器升级到chrome94版本出现CORS跨域问题 问题描述 解决谷歌浏览器最新chrome94版本CORS跨域问题。 CORS跨域问题&#xff1a; 升级谷歌浏览器最新chrome94版本后&#xff0c;提示Access to XMLHttpRequest at ‘http://localhost:xxxx/api’ fro…

uni-app发布 h5 与ASP .NET MVC 后台 发布 到 IIS的同一端口 并配置跨域

iis 安装URL重写 选择对应的后台项目&#xff0c;进行url重写 编辑【模式】部分的内容的重写规则&#xff0c;我这里是h5中请求的前缀是api&#xff0c;大家可以根据自己的前缀进行修改。 编写【操作类型】为重写&#xff0c;并写重写url&#xff0c;按照图中设置即可。 uni…