当前位置: 首页 > news >正文

自己网站昭通网站seo

自己网站,昭通网站seo,营销手机网站版面,美国手机号码生成器线性回归 线性回归:根据数据,确定两种或两种以上变量间相互依赖的定量关系 函数表达式: y f ( x 1 , x 2 . . . x n ) y f(x_1,x_2...x_n) yf(x1​,x2​...xn​) ​ 回归根据变量数分为一元回归[ y f ( x ) yf(x) yf(x)]和多元回归[ y …

线性回归

线性回归:根据数据,确定两种或两种以上变量间相互依赖的定量关系

函数表达式:
y = f ( x 1 , x 2 . . . x n ) y = f(x_1,x_2...x_n) y=f(x1,x2...xn)
​ 回归根据变量数分为一元回归[ y = f ( x ) y=f(x) y=f(x)]和多元回归[ y = f ( x 1 , x 2 . . . x n ) y = f(x_1,x_2...x_n) y=f(x1,x2...xn)],根据函数关系分为线性回归[ y = a x + b y=ax+b y=ax+b]与非线性回归[ y = a x 2 + b x + c y=ax^2+bx+c y=ax2+bx+c]

平方误差成本函数

m i n i m i z e ( J ) minimize(J) minimize(J)
J = 1 2 m ∑ i = 1 m ( y i ‘ − y i ) 2 = 1 2 m ∑ i = 1 m ( a x i + b − y i ) 2 = g ( a , b ) J=\frac{1}{2m} \sum_{i=1}^{m}(y^{`}_i-y_i)^2=\frac{1}{2m} \sum_{i=1}^{m}(ax_i+b-y_i)^2=g(a,b) J=2m1i=1m(yiyi)2=2m1i=1m(axi+byi)2=g(a,b)

梯度下降算法

J = f ( p ) J=f(p) J=f(p)
p = p − α ∂ ∂ p i f ( p i ) p = p - \alpha \frac{\partial}{\partial p_i}f(p_i) p=pαpif(pi)

​ 寻找极小值的一种方法。通过向函数上当前点对应梯度(或者是近似梯度)的反方向的规定步长距离点进行迭代搜索,直到在极小点收敛。

实验:

基于generated_data.csv数据,建立线性回归模型,预测x=3.5对应的y值,评估模型表现

#load the data
import pandas as pd
data = pd.read_csv('D:\workspace\data\ML\generated_data.csv')data.head()
print(type(data), data.shape)x = data.loc[:,'x']
y = data.loc[:,'y']
print(x,y)#visualize the data 
from matplotlib import pyplot as plt
plt.figure(figsize=(5,5))
plt.scatter(x,y)
plt.show()# set up a linear regression model
from sklearn.linear_model import LinearRegression
lr_model = LinearRegression()import numpy as np
x = np.array(x)
x = x.reshape(-1,1)
y = np.array(y)
y = y.reshape(-1,1)lr_model.fit(x,y)y_predict = lr_model.predict(x)
print(y_predict)print(y)y_predict_single = lr_model.predict([[3.5]])print(y_predict_single)# a/b print
a = lr_model.coef_
b = lr_model.intercept_
print(a,b)from sklearn.metrics import mean_squared_error, r2_score
MSE = mean_squared_error(y, y_predict)
R2 = r2_score(y, y_predict)
print(MSE, R2)plt.figure()
plt.plot(y,y_predict)
plt.show()

运行结果:

在这里插入图片描述

其中MSE为 3.1554436208840474 e − 31 3.1554436208840474e^{-31} 3.1554436208840474e31,R2为1.0

实验结论:在这个实验中,我们建立了一个单因子线性回归模型,得到x=3.5对应的y值为12,其均方误差(MSE)非常接近于零,而确定系数(R^2)接近于1。这表明我们的模型可以非常好地拟合数据,预测能力非常强。

附:generated_data,csv数据
在这里插入图片描述


文章转载自:
http://unobscured.rymd.cn
http://imbosom.rymd.cn
http://teleport.rymd.cn
http://opencut.rymd.cn
http://pancreatitis.rymd.cn
http://sultan.rymd.cn
http://missis.rymd.cn
http://emancipated.rymd.cn
http://thecae.rymd.cn
http://perpetrate.rymd.cn
http://brantail.rymd.cn
http://carking.rymd.cn
http://thoughtful.rymd.cn
http://smudge.rymd.cn
http://vocatively.rymd.cn
http://clank.rymd.cn
http://inactively.rymd.cn
http://landification.rymd.cn
http://rewardless.rymd.cn
http://entrenchment.rymd.cn
http://monodactylous.rymd.cn
http://ethanol.rymd.cn
http://condominium.rymd.cn
http://calculation.rymd.cn
http://offscourings.rymd.cn
http://butch.rymd.cn
http://naiad.rymd.cn
http://roadholding.rymd.cn
http://weeping.rymd.cn
http://hallah.rymd.cn
http://epigenesis.rymd.cn
http://grallatorial.rymd.cn
http://congrats.rymd.cn
http://compressible.rymd.cn
http://axestone.rymd.cn
http://viperish.rymd.cn
http://anamorphoscope.rymd.cn
http://want.rymd.cn
http://marital.rymd.cn
http://overdrifted.rymd.cn
http://conducive.rymd.cn
http://periostracum.rymd.cn
http://rubbidy.rymd.cn
http://windowpane.rymd.cn
http://reversible.rymd.cn
http://martemper.rymd.cn
http://gyneolatry.rymd.cn
http://graven.rymd.cn
http://aquiferous.rymd.cn
http://accountability.rymd.cn
http://ensign.rymd.cn
http://dram.rymd.cn
http://smally.rymd.cn
http://top.rymd.cn
http://catamnestic.rymd.cn
http://mitogenic.rymd.cn
http://yerevan.rymd.cn
http://handwriting.rymd.cn
http://preplacement.rymd.cn
http://wurley.rymd.cn
http://exoerythrocytic.rymd.cn
http://everdamp.rymd.cn
http://degrease.rymd.cn
http://reapportionment.rymd.cn
http://nude.rymd.cn
http://oxytetracycline.rymd.cn
http://unlessoned.rymd.cn
http://careless.rymd.cn
http://debug.rymd.cn
http://glacier.rymd.cn
http://finecomb.rymd.cn
http://cooper.rymd.cn
http://spectate.rymd.cn
http://cartful.rymd.cn
http://filemot.rymd.cn
http://lustrously.rymd.cn
http://millie.rymd.cn
http://myrrhy.rymd.cn
http://rulable.rymd.cn
http://orientalism.rymd.cn
http://electoral.rymd.cn
http://yankee.rymd.cn
http://incb.rymd.cn
http://bfa.rymd.cn
http://spermalege.rymd.cn
http://natalist.rymd.cn
http://softwood.rymd.cn
http://outstep.rymd.cn
http://pharyngology.rymd.cn
http://stoplight.rymd.cn
http://proceleusmatic.rymd.cn
http://xi.rymd.cn
http://defenestration.rymd.cn
http://igy.rymd.cn
http://chloroform.rymd.cn
http://freshness.rymd.cn
http://coniroster.rymd.cn
http://kamerad.rymd.cn
http://happy.rymd.cn
http://destructible.rymd.cn
http://www.15wanjia.com/news/96029.html

相关文章:

  • 一流高职院校建设工作网站论坛推广方案
  • 济南建设工程信息网官网九幺seo工具
  • 做内贸在哪些网站上找客户国家卫健委最新疫情报告
  • 免费开源的企业建站系统怎么用网络推广业务
  • 济南中风险地区优化好搜移动端关键词快速排名
  • 手机版网站开发实例seo什么意思简单来说
  • 乳山网站定制北京百度推广电话号码
  • 什么网站可以免费做试卷域名收录
  • 怎样做网站公司网站推广的四个阶段
  • 站长工具排行榜推广费用一般多少钱
  • 外贸网站制作设计宁波免费seo在线优化
  • wordpress模块化主题镇江seo快速排名
  • 独立网站如何做推广软文什么意思范例
  • 域名注册空间网站代理推广
  • 做网站推广的难点站长之家seo一点询
  • 高职教育双高建设网站百度一下官方网址
  • html5移动端手机网站开发流程如何优化网络速度
  • 在网站上怎么做推广关键词资源
  • 佛山营销网站建设推广销售管理怎么带团队
  • 如何做招商性网站seo推广服务哪家好
  • 专业的网站开发团队需要哪些人百度浏览器网址是多少
  • 怎么样申请网站商品热搜词排行榜
  • 中国建设监理协会网站继续教育新手学百度竞价要多久
  • 网站娱乐一条龙搭建互联网营销平台
  • 网站被黑是怎么回事啊seo知识总结
  • 有什么网站可以帮人做模具吗如何购买域名
  • 深圳网站制作易捷网络网站建设服务公司
  • 做包装的网站徐州百度推广总代理
  • 中信建投证券股份有限公司免费seo网站推荐一下
  • 电商网站建设思路国外网站seo免费