您现在的位置是:热点 >>正文
用 Python 轻松实现机器学习
热点206人已围观
简介...
用朴素贝叶斯分类器解决现实世界里的机器学习问题。
朴素贝叶斯Naïve Bayes是一种分类技术,它是许多分类器建模算法的基础。基于朴素贝叶斯的分类器是简单、快速和易用的机器学习技术之一,而且在现实世界的应用中很有效。
朴素贝叶斯是从 贝用 叶斯定理Bayes' theorem 发展来的。贝叶斯定理由 18 世纪的统计学家 托马斯·贝叶斯 提出,它根据与一个事件相关联的其他条件来计算该事件发生的概率。比如,帕金森氏病 患者通常嗓音会发生变化,因此嗓音变化就Py是与预测帕金森氏病相关联的症状。贝叶斯定理提供了计算目标事件发生概率的方法,而朴素贝叶斯是对该方法的推广和简化。
解决一个现实世界里的问题
这篇文章展示了朴素贝叶斯分类器解决现实世界问题(相对于完整的商业级应用)的能力。我会假设你对机器学习有基本的th了解,所以文章里会跳过一些与机器学习预测不大相关的步骤,比如 数据打乱date shuffling 和 数据切片data splitting。如果你是机器学习方面的新手或者需要一个进修课程,请查看 《An introductionon to machine learning today》 和 《Getting started with open source machine learning》。
朴素贝叶斯分类器是 有监督的supervised、属于 生成模型generative&n 轻bsp;的、非线性的、属于 参数模型parametric 的和 基于概率的probabilistic。
在这篇文章里,我会演示如何用朴素贝叶斯预测帕金森氏病。需要用到的数据集来自 UCI 机器学习库。这个数据集包松实含许多语音信号的指标,用于计算患帕金森氏病的可能性;在这个例子里我们将使用这些指标中的前 8 个:
MDVP:Fo(Hz):平均声带基频 MDVP:Fhi(Hz):最高声带基频 MDVP:Flo(Hz):最低声带基频 MDVP:Jitter(%)、MDVP:Ji现机tter(Abs)、MDVP:RAP、MDVP:PPQ 和 Jitter:DDP:5 个衡量声带基频变化的指标
这个例子里用到的数据集,可以在我的 GitHub 仓库 里找到。数据集已经事先做了打乱和切片。
用器学 Python 实现机器学习
接下来我会用 Python 来解决这个问题。我用的软件是:
Python 3.8.2 Pandas 1.1.1 scikit-learn 0.22.2.post1
Python 有多个朴素贝叶斯分类器的实用 现,都是开源的,包括:
NLTK Naïve Bayes:基于标准的朴素贝叶斯算法,用于文本分类 NLTK Positive Naïve Bayes:NLTK Naïve Bayes 的变体,用于对只标注了一部分的训练集进行二分类 Scikit-leaPyrn Gaussian Naïve Bayes:提供了部分拟合方法来支持数据流或很大的数据集(LCTT 译注:它们可能无法一次性导入内存,用部分拟合可以动态地增加数据) Scikit-learn Multinomial Naïve Bayes:针th对离散型特征、实例计数、频率等作了优化 Scikit-learn Bernoulli Naïve Bayes:用于各个特征都是二元变量/布尔特征的情况
在这个例子里我将使用 sklearn Gaussian Naive Bayes。
我的 Python 实现在on naive_bayes_parkinsons.py 里,如下所示:
import pandas as pd # x_rows 是我们所使用的 8 个特征的列名x_rows=['MDVP:Fo(Hz)','MDVP:Fhi(Hz)','M 轻DVP:Flo(Hz)', 'MDVP:Jitter(%)','MDVP:Jitter(Abs)','MDVP:RAP','MDVP:PPQ','Jitter:DDP']y_rows=['status'] # y_rows 是类别的列名,若患病,值为 1,松实若不患病,值为 0 # ѵ
Tags:
相关文章
马斯克旗下xAI起诉苹果和OpenAI 指控合谋垄断AI市场
热点8 月 25 日,埃隆·马斯克旗下的人工智能公司xAI向美国联邦法院提起诉讼,指控苹果公司和OpenAI涉嫌合谋垄断人工智能市场。这起诉讼引发了科技行业的广泛关注。 据诉状显示,xAI指控苹果与Ope...
【热点】
阅读更多MetaGPT推出端到端自动化测试工具RealDevWorld,达到精准度92%
热点随着人工智能技术在软件开发领域的深入应用,自动化测试工具的创新不断推动行业效率提升。近日, MetaGPT 正式发布了一款备受期待的端到端自动化测试工具—— RealDevWorld ,旨在通过多智能...
【热点】
阅读更多标签: 广州地铁 摇一摇广告 App优化
热点云梦级11月3日云梦级消息,针对“广州地铁 App 乘车码页面‘摇一摇’广告影响扫码”一事,11 月 3 日,广州地铁方面回复澎湃新闻称,关注到网民的建议后,当即关闭该位置广告,并与合作商沟通,完善广...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.symatoys.com/search.html?ID=UyMD6aO58bPrJvQAB1I0N69KzJBZeNPC&keyword=黑帽seo寄生虫程序【tg:seogoogle987】,KJs
- https://www.ntv.co.jp/3min/search/?action=QUERY&q=黑帽seo寄生虫程序【tg:seogoogle987】,W6g
- https://www.sensorshop24.de/catalogsearch/result/index/?type=132&q=黑帽seo寄生虫程序【tg:seogoogle987】,Ahs
- https://www.maigoo.com/search/?block=&q=黑帽seo寄生虫程序【tg:seogoogle987】,NfT
- https://www.niaogebiji.com/pc/article/search?keyword=黑帽seo寄生虫程序【tg:seogoogle987】,RLf
- https://www.goodreads.com/quotes/tag/黑帽seo寄生虫程序【tg:seogoogle987】P0I
- https://www.unclefossil.com/search/黑帽seo寄生虫程序【tg:seogoogle987】,IPo
- https://www.polliwogs.com/search/黑帽seo寄生虫程序【tg:seogoogle987】,4dX
- https://www.msrenewal.com/search/黑帽seo寄生虫程序【tg:seogoogle987】,0TY
- https://www.unclefossil.com/search/黑帽seo寄生虫程序【tg:seogoogle987】gad_source=1&gclid=Cj0KCQjw_-GxBhC1ARIsADGgDjsNKplUXa2F6YGlHBK2sHDQ88cgsJBb05DyO99TV9jNq_cT0kGMqyQaAgHQEALw_wcB
- https://yscc1986.net/search/黑帽seo寄生虫程序【tg:seogoogle987】jBD
- https://www.vet-direct.com/search?cat=72&term=黑帽seo寄生虫程序【tg:seogoogle987】,u5x
- https://www.seagrant.wisc.edu/?page=63&s=黑帽seo寄生虫程序【tg:seogoogle987】,w6n
- https://www.nuovabai.it/catalogsearch/result/?action=SEARCH&q=黑帽seo寄生虫程序【tg:seogoogle987】,5Bd
- https://www.seforall.org/search?keywords=黑帽seo寄生虫程序【tg:seogoogle987】,DWX
- https://www.synonyms.com/antonyms/黑帽seo寄生虫程序【tg:seogoogle987】,aoR
- https://www.polar-tech.com/?action=QUERY&s=黑帽seo寄生虫程序【tg:seogoogle987】,mTQ
- https://www.prattlibrary.org/search?q=黑帽seo寄生虫程序【tg:seogoogle987】,Fga
- https://www.silentiumpc.com/en/search/黑帽seo寄生虫程序【tg:seogoogle987】,zk0
- https://www.navylookout.com/?ID=nSBR6Ivdu6lZg1yr2SDs30Lo5sTs76yJ&s=黑帽seo寄生虫程序【tg:seogoogle987】,AKB
- https://www.pearson.com/en-us/search.html?aq=黑帽seo寄生虫程序【tg:seogoogle987】,6dw
- https://www.lezhin.com/ko/tags/黑帽seo寄生虫程序【tg:seogoogle987】,MaM
- https://blvdseafood.com/?s=黑帽seo寄生虫程序【tg:seogoogle987】Lwi
- https://www.uctronics.com/catalogsearch/result/?q=黑帽seo寄生虫程序【tg:seogoogle987】,Q4a
- https://www.teamlab.art/zh-hans/?submit=黑帽seo寄生虫程序【tg:seogoogle987】,s0f
- https://yokohama-oht.com/?action=CHECK&s=黑帽seo寄生虫程序【tg:seogoogle987】,ADZ
- https://www.spicebar.de/catalogsearch/result/?q=黑帽seo寄生虫程序【tg:seogoogle987】,Yrq
- https://www.soccerbible.com/search?q=黑帽seo寄生虫程序【tg:seogoogle987】,8mt
- https://www.qwant.com/?q=黑帽seo寄生虫程序【tg:seogoogle987】,XOI
- https://www.umc.edu/search.aspx?ID=I4gnDKRS991MFcIDDzoYze4aWSAszAm7&q=黑帽seo寄生虫程序【tg:seogoogle987】,ShP
- https://m.shoppinghow.kakao.com/m/search/q/黑帽seo寄生虫程序【tg:seogoogle987】dNj
- https://www.manga-news.com/index.php/recherche/?q=黑帽seo寄生虫程序【tg:seogoogle987】,x94
- https://www.paulaschoice.hk/zh_hant/catalogsearch/result/?q=黑帽seo寄生虫程序【tg:seogoogle987】,l5i
- https://www.lifesciencesweden.se/search?q=黑帽seo寄生虫程序【tg:seogoogle987】,ZjE
- https://www.routesonline.com/search/?query=黑帽seo寄生虫程序【tg:seogoogle987】,8Qt
- https://www.miamiopenmri.com/?action=CHECK&s=黑帽seo寄生虫程序【tg:seogoogle987】,HXd
- https://www.southmeadows.co.uk/2019/07/?s=黑帽seo寄生虫程序【tg:seogoogle987】,qIL
- https://www.merchbar.com/search?q=黑帽seo寄生虫程序【tg:seogoogle987】,Wlb
- https://www.ussalabama.com/?action=CHECK&s=黑帽seo寄生虫程序【tg:seogoogle987】,5jH
- https://www.lneg.pt/en/?s=黑帽seo寄生虫程序【tg:seogoogle987】,Nmr
- https://www.sic-info.org/vi/?s=黑帽seo寄生虫程序【tg:seogoogle987】,bMA
- https://www.flickr.com/photos/tags/黑帽seo寄生虫程序【tg:seogoogle987】rSH
- https://www.pierreherme.com/catalogsearch/result/?q=黑帽seo寄生虫程序【tg:seogoogle987】,b0M
- https://www.lauben.com/en/?action=SEARCH&s=黑帽seo寄生虫程序【tg:seogoogle987】,Nsv
- https://www.localfootdoc.com/?s=黑帽seo寄生虫程序【tg:seogoogle987】,dpS
- https://www.welshmountainzoo.org/shop/index.php?routeproduct/search&tag=黑帽seo寄生虫程序【tg:seogoogle987】,uBc
- https://www.remit.co.jp/vi/?s=黑帽seo寄生虫程序【tg:seogoogle987】,TbL
- https://www.mynextmove.org/find/search?s=黑帽seo寄生虫程序【tg:seogoogle987】,OZD
- https://www.abbreviations.com/黑帽seo寄生虫程序【tg:seogoogle987】F55
- https://www.tarleton.edu/?s=黑帽seo寄生虫程序【tg:seogoogle987】,1FH