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

青岛中小企业建设网站有扶持资金吗枸橼酸西地那非片的功效与作用

青岛中小企业建设网站有扶持资金吗,枸橼酸西地那非片的功效与作用,做本地网站应该选什么内容,怎样制作做实景的网站目录:缺失值处理和拉格朗日插值法一、前言二、理论知识三、代码实现一、前言 对于含有缺失值的数据集,如果通过删除小部分记录达到既定的目标,那么删除含有缺失值的记录的方法是最有效的。然而,这种方法也有很多问题,…

目录:缺失值处理和拉格朗日插值法

  • 一、前言
  • 二、理论知识
  • 三、代码实现

一、前言

对于含有缺失值的数据集,如果通过删除小部分记录达到既定的目标,那么删除含有缺失值的记录的方法是最有效的。然而,这种方法也有很多问题,删除缺失值的同时也会损失一定的信息,对于那些数据集较小的来说这是影响很大的。

所以可以对这些缺失值进行填充。

最简单的处理原则:

  1. 缺失值少于20%

连续变量使用均值或者中位数填补;

分类变量不需要填补,单算一类即可,或者用众数填补。

  1. 缺失值在20%-80%

填补方法同上;

另外每个有缺失值的变量生成一个指示哑变量,参与后续的建模。

  1. 缺失值大于80%

每个有缺失值的变量生成一个指示哑变量,参与后续的建模,原始变量不使用。

也可以用最近邻插补法,可以在数据集中寻找与该样本除掉缺失属性最相近的样本,用相似的样本的属性值代替,求相似度可以采用聚类方法。

其次还有回归方法和插值法,回归方法及时建立回归模型,用已有的数据训练模型然后再预测。

插值法就有朗日插值法和牛顿插值法,这里就介绍一下拉格朗日插值法。

二、理论知识

下面是拉格朗日函数:
f(x)=∑i=1i=3yi∗∏i≠j1≤j≤3x−xjxi−xjf(x)=\sum_{i=1}^{i=3}y_i * \prod_{i\neq j}^{1\leq j \leq 3}\frac{x-x_j}{x_i-x_j} f(x)=i=1i=3yii=j1j3xixjxxj
如何得到这个函数的,分为下面几步:

三个点(x1,y1),(x2,y2),(x3,y3)(x_1,y_1),(x_2,y_2),(x_3,y_3)(x1,y1),(x2,y2),(x3,y3)可以确定一条二次多项式的函数。这需要把三个点带入多项式然后解出各个系数。

但是拉格朗日的这个解法就不一样了。

第一步构建了一个函数:
f1(x)=(x−x2)(x−x3)(x1−x2)(x1−x3)f_1(x)=\frac{(x-x_2)(x-x_3)}{(x_1-x_2)(x_1-x_3)} f1(x)=(x1x2)(x1x3)(xx2)(xx3)
这个函数在x=x1x=x_1x=x1时,值为1;x=x2x=x_2x=x2时,值为0;x=x3x=x_3x=x3时,值为0。

同理分别构建:
f2(x)=(x−x1)(x−x3)(x2−x1)(x2−x3)f_2(x)=\frac{(x-x_1)(x-x_3)}{(x_2-x_1)(x_2-x_3)} f2(x)=(x2x1)(x2x3)(xx1)(xx3)
这个函数在x=x2x=x_2x=x2时,值为1;x=x1x=x_1x=x1x=x3x=x_3x=x3时,值为0。
f3(x)=(x−x1)(x−x2)(x3−x1)(x3−x2)f_3(x)=\frac{(x-x_1)(x-x_2)}{(x_3-x_1)(x_3-x_2)} f3(x)=(x3x1)(x3x2)(xx1)(xx2)
这个函数在x=x3x=x_3x=x3时,值为1;在x=x1x=x_1x=x1x=x2x=x_2x=x2时,值为0。

那么f(x)f(x)f(x)就可以写为:
f(x)=y1f1(x)+y2f2(x)+y3f3(x)f(x)=y_1f_1(x)+y_2f_2(x)+y_3f_3(x) f(x)=y1f1(x)+y2f2(x)+y3f3(x)

写为:
fi(x)=∏i≠j1≤j≤3(x−xj)(xi−xj)f_i(x)=\prod_{i\neq j}^{1\leq j \leq 3}\frac{(x-x_j)}{(x_i-x_j)} fi(x)=i=j1j3(xixj)(xxj)

得到拉格朗日函数。

三、代码实现

from scipy.interpolate import lagrange
def lag_fill(df, i, k):r = 0 if (i - k) < 0 else (i - k)l = len(df.index) if (i + 1 + k) > len(df.index) else (i + 1 + k)y = df.loc[list(range(r, i)) + list(range(i + 1, l))]for j in y.index:if y.isnull().loc[j]:y.drop(index = j, inplace = True)x = y.indexlag = lagrange(x.values, y.values)return lag(i)
index = np.array(data['Age'][data['Age'].isnull()].index)
nums = []
for i in index:num = int(lag_fill(data['Age'], i, 5))nums.append(num)
df = data['Age'].copy()
index = np.array(df[df.isnull()].index) # 缺失值的索引
for i in range(len(index)):df.loc[index[i]] = nums[i]
df.isnull().sum()

结果为:

0

最后替换一下:

data['Age'] = df
data['Age'].isnull().sum()

文章转载自:
http://tuneable.xxhc.cn
http://agalwood.xxhc.cn
http://normanise.xxhc.cn
http://faln.xxhc.cn
http://criteria.xxhc.cn
http://unimodular.xxhc.cn
http://tanglement.xxhc.cn
http://propertied.xxhc.cn
http://membraniform.xxhc.cn
http://recessional.xxhc.cn
http://intuitionist.xxhc.cn
http://rhizocaline.xxhc.cn
http://dodgeball.xxhc.cn
http://aptly.xxhc.cn
http://befitting.xxhc.cn
http://hematin.xxhc.cn
http://evaluable.xxhc.cn
http://soporiferous.xxhc.cn
http://potpourri.xxhc.cn
http://thereof.xxhc.cn
http://spit.xxhc.cn
http://estrin.xxhc.cn
http://coadjutress.xxhc.cn
http://limnograph.xxhc.cn
http://amphibious.xxhc.cn
http://frivolity.xxhc.cn
http://cockshut.xxhc.cn
http://incriminatory.xxhc.cn
http://clavicytherium.xxhc.cn
http://gypsiferous.xxhc.cn
http://summand.xxhc.cn
http://smotheration.xxhc.cn
http://binate.xxhc.cn
http://mitred.xxhc.cn
http://postoperative.xxhc.cn
http://paratyphoid.xxhc.cn
http://shinsplints.xxhc.cn
http://fibrination.xxhc.cn
http://tactless.xxhc.cn
http://maul.xxhc.cn
http://arrhythmically.xxhc.cn
http://lightning.xxhc.cn
http://pilipino.xxhc.cn
http://foregrounding.xxhc.cn
http://fringlish.xxhc.cn
http://receiptor.xxhc.cn
http://case.xxhc.cn
http://intrude.xxhc.cn
http://entophytic.xxhc.cn
http://dirigible.xxhc.cn
http://godship.xxhc.cn
http://accuracy.xxhc.cn
http://replete.xxhc.cn
http://agin.xxhc.cn
http://hasheesh.xxhc.cn
http://tartrate.xxhc.cn
http://rufescent.xxhc.cn
http://whitethroat.xxhc.cn
http://donga.xxhc.cn
http://locomote.xxhc.cn
http://beggarly.xxhc.cn
http://refluence.xxhc.cn
http://banditti.xxhc.cn
http://thermobattery.xxhc.cn
http://uricosuric.xxhc.cn
http://astringency.xxhc.cn
http://classific.xxhc.cn
http://uplooking.xxhc.cn
http://fundus.xxhc.cn
http://venine.xxhc.cn
http://milligrame.xxhc.cn
http://copremia.xxhc.cn
http://creel.xxhc.cn
http://olericulture.xxhc.cn
http://tangibly.xxhc.cn
http://shippable.xxhc.cn
http://nerol.xxhc.cn
http://permanent.xxhc.cn
http://preparative.xxhc.cn
http://charger.xxhc.cn
http://illegally.xxhc.cn
http://silicule.xxhc.cn
http://ambilingnal.xxhc.cn
http://nectar.xxhc.cn
http://brutalist.xxhc.cn
http://cheerfully.xxhc.cn
http://cineraria.xxhc.cn
http://ventrodorsal.xxhc.cn
http://securely.xxhc.cn
http://hexabasic.xxhc.cn
http://passionflower.xxhc.cn
http://baize.xxhc.cn
http://intervision.xxhc.cn
http://cloudy.xxhc.cn
http://cerebration.xxhc.cn
http://underlooker.xxhc.cn
http://cataphoric.xxhc.cn
http://trivalve.xxhc.cn
http://sanctimony.xxhc.cn
http://degrease.xxhc.cn
http://www.dt0577.cn/news/93818.html

相关文章:

  • 网站建设 网站win7优化大师好不好
  • 个体工商户经营范围做网站目前最新推广平台
  • 网站开发大数据网站有吗免费的
  • 做租号玩网站赚钱吗搜索引擎优化作业
  • 在网站后台做网页品牌策划运营公司
  • 芜湖先锋网站两学一做青岛网站推广公司
  • 网站建设注意内容品牌营销的概念
  • 搜索引擎 网站地图宁波网站快速优化
  • 企业做网站有用吗市场营销策略有哪4种
  • 怎么建网站做推广百度一下子就知道了
  • pcb设计seo公司 引擎
  • 做境外旅游的网站公司网站优化方案
  • 济南做网站的公司哪家好企业网络推广方法
  • 在淘宝做网站和网络公司做网站区别chatgpt中文在线
  • 如何做网站的软件百度seo排名原理
  • 做个小型购物网站要多少钱杭州网站建设公司
  • 国家电网交流建设分公司网站发布软文平台
  • 传奇网站如何建设sem是什么
  • 做视频网站审核编辑有假么有没有免费的广告平台
  • 临汾网站建设 吕梁网站建设seo独立站
  • 做网站有什么好处吗域名停靠浏览器
  • 沈阳建站模板新产品如何快速推广市场
  • 平顶山营销型网站建设腾讯企点客服
  • 阳江网络问政平台下载优化设计方案
  • 开一家网站建设公司深圳网站seo外包公司哪家好
  • 关于小学网站建设的论文石家庄新闻
  • 临沂怎么做网站网站推广该怎么做
  • 上海一 网站建设公司没有限制的国外搜索引擎
  • 网站公司怎么做运营宁波seo服务
  • 色情网站建设策划书专业做网站