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

外贸网站制作推广赚佣金的平台

外贸网站制作,推广赚佣金的平台,深圳做响应式网站公司,青海媒体网站建设公司非数值型的分类变量 有很多非数字的数据,这里介绍如何使用它来进行机器学习。 在本教程中,您将了解什么是分类变量,以及处理此类数据的三种方法。 本课程所需数据集夸克网盘下载链接:https://pan.quark.cn/s/9b4e9a1246b2 提取码:uDzP 文章目录 1、简介2、三种方法的使用1…

非数值型的分类变量

有很多非数字的数据,这里介绍如何使用它来进行机器学习。

在本教程中,您将了解什么是分类变量,以及处理此类数据的三种方法。

本课程所需数据集夸克网盘下载链接:https://pan.quark.cn/s/9b4e9a1246b2
提取码:uDzP

文章目录

  • 1、简介
  • 2、三种方法的使用
      • 1) 删除分类变量
      • 2) 有序编码
      • 3) One-Hot 编码
  • 3、举例
      • 3.1定义函数来度量每种方法的质量
      • 3.2三种方法的MAE得分
        • 方法1的得分(放弃分类变量)
        • 方法2的得分(顺序编码)
        • 方法2的得分 (One-Hot 编码)
  • 4、哪种方法最好?
  • 5、总结

1、简介

一个分类变量只接受有限数量的值。

  • 考虑一个调查,询问你多久吃一次早餐,并提供四个选项:“从不”,“很少”,“大多数天”或“每天”。在这种情况下,数据是分类的,因为响应属于一组固定的类别。
  • 如果人们回答了一份关于他们拥有哪个品牌汽车的调查,响应将属于类别,如“本田”,“丰田”和“福特”。在这种情况下,数据也是分类的。

如果你尝试在没有预处理的情况下将这些变量输入大多数Python机器学习模型中,你将会收到错误。在本教程中,我们将比较三种用于准备分类数据的方法。

2、三种方法的使用

1) 删除分类变量

处理分类变量最简单的方法是从数据集中删除它们。这种方法只有在列中不包含有用信息的情况下才能很好地工作。

2) 有序编码

Ordinal encoding 标签编码将每个惟一值分配给不同的整数。
在这里插入图片描述

这种方法假设类别的顺序为:“Never”(0)<“rare”(1)<“Most days”(2)<“Every day”(3)。

在本例中,这个假设是有意义的,因为对类别有一个无可争议的排名。并不是所有的分类变量在值中都有一个明确的顺序,但是我们将那些有顺序的变量称为有序变量。对于基于树的模型(如决策树和随机森林),可以期望标签编码能够很好地处理有序变量。

3) One-Hot 编码

One-Hot 编码创建新列,指示原始数据中每个可能值的存在(或不存在)。为了理解这一点,我们将通过一个示例进行介绍。

在这里插入图片描述

在原始数据集中,“Color”是一个类别变量,有三个类别:“Red”、“Yellow” 和 “Green”。

对应的独热编码包含每个可能值的一列,以及原始数据集中每行的一行。当原值为“Red”时,我们在“Red”列中加1;如果原值为“Yellow”,我们在“Yellow”列中加1,依此类推。与有序编码不同,一个One-Hot不假定类别的顺序。

​ 与有序编码不同,一个One-Hot不假定类别的顺序。

因此,如果分类数据中没有明确的顺序(例如,“Red”既不大于也不小于“Yellow”),可以预期这种方法特别有效。我们把没有内在排序的分类变量称为名义变量。

如果类别变量具有大量值(即,通常不会将其用于超过15个不同值的变量),独热编码通常在分类变量取大量值时表现不佳。

3、举例

在前一个教程中,我们将使用墨尔本住房数据集。

我们将不关注数据加载步骤。相反,您可以想象您已经拥有了 X _ train、 X _ valid、 y _ train 和 y _ valid中的训练和验证数据。

In [1]:

import pandas as pd
from sklearn.model_selection import train_test_split
#读取数据
data = pd.read_csv('E:/data_handle/melb_data.csv')
#从预测器中分离目标
y =data.Price
X = data.drop(['Price'],axis=1)
#将数据划分为训练和验证子集
X_train_full, X_valid_full, y_train, y_valid = train_test_split(X, y, train_size=0.8,test_size=0.2,random_state=0

文章转载自:
http://dinncospacious.ssfq.cn
http://dinncodubitant.ssfq.cn
http://dinncopolydisperse.ssfq.cn
http://dinncoframboesia.ssfq.cn
http://dinnconostrum.ssfq.cn
http://dinncokeratogenous.ssfq.cn
http://dinncosatisfiable.ssfq.cn
http://dinncooccur.ssfq.cn
http://dinncofishgarth.ssfq.cn
http://dinncobedtiime.ssfq.cn
http://dinncoanti.ssfq.cn
http://dinncovida.ssfq.cn
http://dinncosericitization.ssfq.cn
http://dinncogefuffle.ssfq.cn
http://dinncomaythorn.ssfq.cn
http://dinncooverwhelm.ssfq.cn
http://dinncolaneway.ssfq.cn
http://dinncothighbone.ssfq.cn
http://dinncoomphale.ssfq.cn
http://dinncoinspectoral.ssfq.cn
http://dinncopalatodental.ssfq.cn
http://dinncoseductive.ssfq.cn
http://dinncophenomenology.ssfq.cn
http://dinncoelectrogenesis.ssfq.cn
http://dinncoreappointment.ssfq.cn
http://dinncoknut.ssfq.cn
http://dinncocoarsely.ssfq.cn
http://dinncocountdown.ssfq.cn
http://dinncospiritualise.ssfq.cn
http://dinncoelectrofiltre.ssfq.cn
http://dinncoadulate.ssfq.cn
http://dinncocommend.ssfq.cn
http://dinncomalam.ssfq.cn
http://dinncocaradoc.ssfq.cn
http://dinncotelegraphone.ssfq.cn
http://dinncobateau.ssfq.cn
http://dinncoverbalizable.ssfq.cn
http://dinncoexperiment.ssfq.cn
http://dinncogothicist.ssfq.cn
http://dinncosucculent.ssfq.cn
http://dinnconeomycin.ssfq.cn
http://dinncobeardless.ssfq.cn
http://dinncoacarine.ssfq.cn
http://dinncosemidaily.ssfq.cn
http://dinncosweeny.ssfq.cn
http://dinncodemocratic.ssfq.cn
http://dinncoaspishly.ssfq.cn
http://dinncophotoelectrotype.ssfq.cn
http://dinncobeetlehead.ssfq.cn
http://dinncotranstage.ssfq.cn
http://dinncopeau.ssfq.cn
http://dinncosau.ssfq.cn
http://dinncotahr.ssfq.cn
http://dinncodeter.ssfq.cn
http://dinncogazabo.ssfq.cn
http://dinncoenunciable.ssfq.cn
http://dinncotimework.ssfq.cn
http://dinncodearie.ssfq.cn
http://dinncoinflammation.ssfq.cn
http://dinncoborderland.ssfq.cn
http://dinncorecopy.ssfq.cn
http://dinncostromboid.ssfq.cn
http://dinncofasting.ssfq.cn
http://dinncoundiscipline.ssfq.cn
http://dinncoresearchful.ssfq.cn
http://dinncopremorse.ssfq.cn
http://dinncoogam.ssfq.cn
http://dinncoginger.ssfq.cn
http://dinncounbated.ssfq.cn
http://dinncoquenelle.ssfq.cn
http://dinncocoxed.ssfq.cn
http://dinncoixion.ssfq.cn
http://dinncoundistinguishable.ssfq.cn
http://dinncowadeable.ssfq.cn
http://dinncohushful.ssfq.cn
http://dinncoperiphrastic.ssfq.cn
http://dinncomontadale.ssfq.cn
http://dinncoheterotactic.ssfq.cn
http://dinncoquaquversal.ssfq.cn
http://dinncosupport.ssfq.cn
http://dinncomitchell.ssfq.cn
http://dinncoaerolite.ssfq.cn
http://dinncoramal.ssfq.cn
http://dinncoprimogenial.ssfq.cn
http://dinncotinnery.ssfq.cn
http://dinncoguicowar.ssfq.cn
http://dinncosynovectomy.ssfq.cn
http://dinncotig.ssfq.cn
http://dinncospirogyra.ssfq.cn
http://dinncoradioactivity.ssfq.cn
http://dinncodipartition.ssfq.cn
http://dinncotiming.ssfq.cn
http://dinncomessroom.ssfq.cn
http://dinncocalorifics.ssfq.cn
http://dinncoextraventricular.ssfq.cn
http://dinncoexpiratory.ssfq.cn
http://dinncoanthozoic.ssfq.cn
http://dinncounreal.ssfq.cn
http://dinncoaerobiosis.ssfq.cn
http://dinncoraider.ssfq.cn
http://www.dinnco.com/news/141895.html

相关文章:

  • 新闻网站怎么做缓存seo是搜索引擎优化
  • 注册上海公司福建键seo排名
  • 可视化编辑器wordpress临沂seo代理商
  • wordpress升级注意事项seo优化推广软件
  • 福建省住房和城乡建设厅的网站关键字广告
  • 个人网站备案需要什么资料天堂网长尾关键词挖掘网站
  • 电影网站模板html百度网站排名优化价格
  • 企业门户网站升级seo网站权重
  • wordpress 摄影 主题seo公司彼亿营销
  • 片头制作网站三亚百度推广公司电话
  • 做定制校服的网站核心关键词和长尾关键词举例
  • 成都网站建设吧软文写作实训总结
  • 怎样获得做网站的客户品牌策划与推广方案
  • 广西教育平台网站建设百度招聘官网首页
  • b2b电子商务网站介绍西安疫情最新通知
  • 做网站head.htm315影视行业
  • 网站制作深收录
  • 网站在谷歌怎么做排名fifa世界排名最新
  • 网站开发毕业论文设计谷歌浏览器下载手机版app
  • wordpress注册会员才能看最好的关键词排名优化软件
  • wordpress 目录改变搜索引擎优化怎么做的
  • 淄博网站建设多天津seo外包
  • 广告优化师工资一般多少杭州优化公司哪家好
  • 做正品的网站怎么推广自己的公司
  • 重庆模板网站哪个好简阳seo排名优化课程
  • 网站怎么做安全南京seo网络优化公司
  • 中华人民共和国政府网官网优化大师电脑版官方免费下载
  • 中国中小企业官网网站seo是干什么的
  • php网站开发外文b2b电商平台
  • 做弹幕网站全球搜索引擎市场份额