5.2人工智能的应用《贝叶斯分类器》课件 -2026-2027学年高中信息科技浙教版必修1

2026-10-22
| 12份
| 27页
| 7人阅读
| 1人下载
普通

内容正文:

null 《经验为舟,算法为桨:贝叶斯分类器的原理与应用探秘》 导学案 班级:____________ 姓名:_____________ 学号:_____________ 【学习目标】 【知识与技能】 1. 能准确解释贝叶斯公式中先验概率、条件概率与后验概率的含义; 2. 列举贝叶斯分类在商业推荐、垃圾邮件过滤、学业预测中的典型案例; 3. 理解影响贝叶斯分类器性能的关键因素。 【过程与方法】 1. 通过问题拆解将现实场景(如商店推荐)转化为概率问题; 2. 使用类比迁移:将垃圾邮件识别逻辑迁移至医疗诊断。 【情感态度价值观】 能够辩证地看待数据保护和开放的重要性和价值。 【自主探究】 任务1:帮助小江做决策,去不去露营?(单一特征下的概率计算) 小江爸爸计划周六早上带小江户外露营。到了周六一早天空多云。 小江爸爸说:我们这儿一个月才下3天雨,下雨的概率只有10%。 小江说:下雨天中有60%早上都是多云的,我们真的要外出露营吗? 小江爸爸说:多云也不见得会下雨,咱们这儿约有 30% 的早上都是多云的。 根据贝叶斯公式,计算多云条件下下雨的概率,决定到底要不要去露营? 贝叶斯公式 P(下雨I多云)=__________________________________________________________________ 去不去露营?请做出决策 去露营 不去露营 (若下雨概率 >30% 则取消露营) 任务2:推测小江会不会下单?(多特征下的概率计算) 小江同学近期在某点单app上的浏览情况如下: 店铺价位 店铺口味 店铺距离 是否下单有一家店铺,特征是“价位低、口味偏甜、距离远”,小江会在该店铺下单吗? 低 清淡 远 否 高 清淡 近 否 高 偏辣 远 否 高 偏甜 远 否 低 偏甜 近 是 低 偏甜 近 是 高 偏甜 近 是 低 偏辣 远 是 P(下单I价位低、口味甜,距离远)=__________________________________________________ 点单APP要不要将这家店推给此用户?请做出决策 推荐 不推荐 (若 P(下单|特征) >50% 则推荐) 任务3:运行代码“店铺智能推荐.py”,体验利用python 机器学习库中的贝叶斯分类器解决问题,并回答下面的问题。 (1)程序加载了什么数据?这些数据有什么用?_____________________________________ (2)程序使用了哪种贝叶斯模型?model.(X,Y)中,X和Y分别对应了数据的哪些部分(特征还是类别)?_________________________________________________________ 类型 使用方法 说明 核心思想(简单比喻) 高斯朴素贝叶斯 GaussianNB(var_smoothing=1e-3) 适用于连续值特征的数据集,模型参数var_smoothing可以缺省,也可以尝试不同的值,如 1e-6, 1e-12 等 假设每个特征在不同类别下的数据分布像一个对称的“钟形曲线”(正态分布)。比如身高170cm,体重60kg,是男生还是女生? 多项式朴素贝叶斯 MultinomialNB(alpha=1) 适用于离散数据,如词频计数,模型参数alpha可以缺省,可以尝试设置为其他正值,如0.5或2.0等 主要用来数东西出现的次数。比如,数一篇文章里各个词出现了多少次,根据这些次数来判断文章类别。 伯努利朴素贝叶斯 BernoulliNB(alpha=1) 适用于特征值为二值(0或1)的情况,例如文档是否包含某个单词参数,alpha可以缺省。 只关心某个特征“有没有”出现,不关心它出现了多少次。比如检查邮件:包含“中奖”这个词吗?(有/无) 包含链接吗?(有/无) 是垃圾邮件吗? 贝叶斯分类器三种类型 (3)程序对什么数据做了预测?___________________________________ 任务4:打开“垃圾邮件过滤.py”补全代码,体验贝叶斯分类器在垃圾邮件识别中的应用。 任务5:实验探究,哪些因素会影响模型的性能(假设我们只关注准确率),并尝试对模型性能做优化,打开“糖尿病诊断.py”进行实验分析。 实验(1) 训练数据选择 数据规模 模型选择 参数设置 准确率 50条 缺省参数 768条 实验(1)发现:对于同一个模型,使用不同的训练数据,预测的准确率一样吗?数量的大小对准确率有什么样的影响? _____________________________________________________________________________ 实验(2) 训练数据选择 模型选择 参数设置 准确率 缺省参数 室验(2)发现:对于同一批训练数据,使用不同的模型,预测的准确率一样吗?_________ 实验(3) 训练数据选择 模型选择 参数设置 准确率 室验(3)发现:对于同一批训练数据,同一个的模型,设置不同的参数,预测的准确率一样吗?__________ 实验结论:想要提高贝叶斯分类的准确性,可以从哪些方面着手?你是如何设置的,使得分类器得到了一个较好的性能?________________________________________________________________________ 【自我评价与思考】 评价维度 具体指标 评价选项 说明 知识掌握 理解贝叶斯分类的基本原理 ⬜ 完全掌握 ⬜ 基本掌握 ⬜ 还需努力 尝试用贝叶斯公式解释:为什么阴天时下雨概率不一定高? 了解贝叶斯分类在日常生活中的应用场景 ⬜ 能列举3个应用 ⬜ 能列举1-2应用 ⬜ 不清楚 观察:天气预报、垃圾邮件过滤、医疗诊断中如何应用贝叶斯分类? 理解影响分类器性能的关键因素 ⬜ 能解释3个因素 ⬜ 能解释1-2个因素 ⬜ 不清楚 思考:为什么同样的算法,医疗诊断比电影推荐需要更多数据? 应用探究 发现贝叶斯分类的新应用场景 ⬜ 有创新想法 ⬜ 有常规想法 ⬜ 无想法 如用students.csv数据预测学习习惯与成绩的关系,基于浏览记录预测购买意向 伦理思辨 理解数据保护的重要性 ⬜ 深刻理解 ⬜ 基本了解 ⬜ 模糊 思辨:个人医疗数据被用于研究是否侵犯隐私? 认识数据开放的科研价值 ⬜ 清晰认识 ⬜ 初步认识 ⬜ 不了解 思考:如何做到隐私和开放研究的平衡 学科网(北京)股份有限公司 $nullnullnull content label Arvind Thirumalai commented on your status. Arvind wrote: ""you know"" Reply to this email to comment on this status. 0 Bargains Here! Buy Phentermin 37.5 mg (K-25) Buy Genuine Phentermin at Low Cost VISA Accepted 30 - $130.50 60 - $219.00 90 - $292.50 120 - $366.00 180 - $513.00 1 Buy Ambiem (Zolpidem) 5mg/10mg @ $2.39/- pill 30 pills x 5 mg - $129.00 60 pills x 5 mg - $199.20 180 pills x 5 mg - $430.20 30 pills x 10 mg - $ 138.00 120 pills x 10 mg - $ 322.80 1 Experience with BiggerPenis Today! Grow 3-inches more The Safest & Most Effective Methods Of_PenisEn1argement. Save your time and money! BetterErections with effective Ma1eEnhancement products. #1 Ma1eEnhancement Supplement. Trusted by Millions. Buy Today! 1 Get Up to 75% OFF at Online WatchesStore Discount Watches for All Famous Brands * Watches: aRolexBvlgari, Dior, Hermes, Oris, Cartier, AP and more brands * Louis Vuitton Bags & Wallets * Gucci Bags * Tiffany & Co Jewerly Enjoy a full 1 year WARRANTY Shipment via reputable courier: FEDEX, UPS, DHL and EMS Speedpost You will 100% recieve your order 1 Hello, Since you are an owner of at least one Google Groups group that uses the customized welcome message, pages or files, we are writing to inform you that we will no longer be supporting these features starting February 2011. We made this decision so that we can focus on improving the core functionalities of Google Groups -- mailing lists and forum discussions. Instead of these features, we encourage you to use products that are designed specifically for file storage and page creation, such as Google Docs and Google Sites. For example, you can easily create your pages on Google Sites and share the site (http://www.google.com/support/sites/bin/answer.py?hl=en&answer=174623) with the members of your group. You can also store your files on the site by attaching files to pages (http://www.google.com/support/sites/bin/answer.py?hl=en&answer=90563) on the site. If you³Øe just looking for a place to upload your files so that your group members can download them, we suggest you try Google Docs. You can upload files (http://docs.google.com/support/bin/answer.py?hl=en&answer=50092) and share access with either a group (http://docs.google.com/support/bin/answer.py?hl=en&answer=66343) or an individual (http://docs.google.com/support/bin/answer.py?hl=en&answer=86152), assigning either edit or download only access to the files. you have received this mandatory email service announcement to update you about important changes to Google Groups. 0 Hi Peter, The hotels are the ones that rent out the tent. They are all lined up on the hotel grounds : )) So much for being one with nature, more like being one with a couple dozen tour groups and nature. I have about 100M of pictures from that trip. I can go through them and get you jpgs of my favorite scenic pictures. Where are you and Jocelyn now? New York? Will you come to Tokyo for Chinese New Year? Perhaps to see the two of you then. I will go to Thailand for winter holiday to see my mom : ) Take care, D 0 Hi Peter, These are the only good scenic ones and it's too bad there was a girl's back in one of them. Just try to enjoy the blue sky : )) D 0 Hi Peter, With Jose out of town, do you want to meet once in a while to keep things going and do some interesting stuff? Let me know Eugene 0 Hydrocodone/Vicodin ES/Brand Watson Vicodin ES - 7.5/750 mg: 30 - $195 / 120 $570 Brand Watson - 7.5/750 mg: 30 - $195 / 120 $570 Brand Watson - 10/325 mg: 30 - $199 / 120 - $588 NoPrescription Required FREE Express FedEx (3-5 days Delivery) for over $200 order Major Credit Cards + E-CHECK 1 Jay Stepp commented on your status. Jay wrote: ""to the" ???" Reply to this email to comment on this status. To see the comment thread, follow the link below: 0 LinkedIn Kerry Haloney requested to add you as a connection on LinkedIn: Peter, I'd like to add you to my professional network on LinkedIn. - Kerry Haloney 0 OEM Adobe & Microsoft softwares Fast order and download Microsoft Office Professional Plus 2007/2010 $129 Microsoft Windows 7 Ultimate $119 Adobe Photoshop CS5 Extended Adobe Acrobat 9 Pro Extended Windows XP Professional & thousand more titles 1 OrderCializViagra Online & Save 75-90% 0nline Pharmacy NoPrescription required Buy Canadian Drugs at Wholesale Prices and Save 75-90% FDA-Approved drugs + Superb Quality Drugs only! Accept all major credit cards 1 Percocet 10/625 mg withoutPrescription 30 tabs - $225! Percocet, a narcotic analgesic, is used to treat moderate to moderately SeverePain Top Quality, EXPRESS Shipping, 100% Safe & Discreet & Private. Buy Cheap Percocet Online 1 Ryan Whybrew commented on your status. Ryan wrote: "turd ferguson or butt horn." 0 Thanks Peter. I'll definitely check in on this. How is your book going? I heard chapter 1 came in and it was in good shape. ;-) I hope you are doing well. Cheers, Troy 0 There was a guy at the gas station who told me that if I knew Mandarin and Python I could get a job with the FBI. 0 This e-mail was sent from a notification-only address that cannot accept incoming e-mail. Please do not reply to this message. Thank you for your online reservation. The store you selected has located the item you requested and has placed it on hold in your name. Please note that all items are held for 1 day. Please note store prices may differ from those online. If you have questions or need assistance with your reservation, please contact the store at the phone number listed below. You can also access store information, such as store hours and location, on the web at http://www.borders.com/online/store/StoreDetailView_98. 0 WHat is going on there? I talked to John on email. We talked about some computer stuff that's it. I went bike riding in the rain, it was not that cold. We went to the museum in SF yesterday it was $3 to get in and they had free food. At the same time was a SF Giants game, when we got done we had to take the train with all the Giants fans, they are 1/2 drunk. 0 Yay to you both doing fine! I'm working on an MBA in Design Strategy at CCA (top art school.) It's a new program focusing on more of a right-brained creative and strategic approach to management. I'm an 1/8 of the way done today! 0 Yo. I've been working on my running website. I'm using jquery and the jqplot plugin. I'm not too far away from having a prototype to launch. You used jqplot right? If not, I think you would like it. 0 You Have Everything To Gain! Incredib1e gains in length of 3-4 inches to yourPenis, PERMANANTLY Amazing increase in thickness of yourPenis, up to 30% BetterEjacu1ation control Experience Rock-HardErecetions Explosive, intenseOrgasns Increase volume ofEjacu1ate Doctor designed and endorsed 100% herbal, 100% Natural, 100% Safe The proven NaturalPenisEnhancement that works! 100% MoneyBack Guaranteeed 1 Zach Hamm commented on your status. Zach wrote: "doggy style - enough said, thank you & good night" 0 $LinkedIn Julius O requested to add you as a connection on LinkedIn: Hi Peter. Looking forward to the book! Accept View invitation from Julius O $nullnull 经验为舟,算法为桨 贝叶斯分类器的原理与应用探秘 CONTENTS 01 情境导入 02 原理剖析 03 算法实现 04 迁移应用 05 性能评估 目录 05 06 评价思考 字体:思源宋体Heavy 2 可能要下雨了,还是不去了吧。 去不去露营? 小江爸爸计划周六早上带小江户外露营。到了周六一早天空多云。 P(下雨)=0.1   P(多云|下雨)=0.6   P(多云)=0.3 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 去不去露营? 小江爸爸计划周六早上带小江户外露营。到了周六一早天空多云。 P(下雨)=0.1  先验概率 P(多云|下雨)=0.6  条件概率 P(多云)=0.3 先验概率 P(下雨|多云)=? 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 从两个人的对话中,我们知道这个问题需要去求在多云条件下,下雨发生的概率,并且我们已经知道了…. 那如何去解决呢 很棒,同学们已经认真完成了课前材料的学习 4 如何计算概率?贝叶斯定理 贝叶斯 托马斯·贝叶斯(Thomas Bayes,1701年—1761年)是一位英国的数学家、统计学家和长老会牧师。他以其在概率论和统计学领域的贡献而闻名。以他名字命名的贝叶斯定理,是现代统计学和机器学习中一个非常重要的概念。 P(A)表示事件A发生的概率 P (B)表示事件B发生的概率 P (A|B)表示事件B发生的条件下事件A发生的概率 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 是的,当我们把这个问题抽象为一个数学模型之后,可以直接使用贝叶斯定理来解决 5 去不去露营? 小江爸爸计划周六早上带小江户外露营。到了周六一早天空多云。可能会下雨,小江些犹豫。 小江爸爸说:我们这儿一个月才下3天雨,下雨的概率只有10%。 小江说:下雨天中有60%早上都是多云的,我们真的要外出露营吗? 小江爸爸说:多云也不见得会下雨,咱们这儿约有30% 的早上都是多云的。 P(下雨)=0.1  先验概率 P(多云|下雨)=0.6  条件概率 P(多云)=0.3 先验概率 P(下雨|多云)= 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 要不要推荐这家店铺? 贝叶斯算法的数学演示 有一家店铺,特征是“价位低、口味偏甜、距离远”,小江会在该店铺下单吗? 朴素贝叶斯假设每个特征之间是相互独立的。特征同时出现的概率等于特征分别出现的概率相乘。 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 但现实问题往往更复杂,我们来看这么一个场景,小江在点外卖看到了一家店铺,它的特征是 并且给出了小江的历史订单数据 7 规律模式 历史经验 有一家店铺,特征是“价位低、口味偏甜、距离远、评价4星、无促销”,小江会在该店铺下单吗? 预测结果 新的数据 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 下面,我们再来看一个更加复杂的问题,其实我们在平时点外卖时,会考虑更多的特征,以及随着我们浏览使用外卖的频次增加,会有更多的历史经验,那么我们还能通过刚才手写的方式去进行新数据的预测吗 8 什么是机器学习 机器学习:研究如何赋予计算机学习能力的一门科学。其核心思想是让计算机通过数据自动学习规律和模式(训练模型),并基于学习结果做出预测或决策。它不依赖显式编程,而是通过算法从经验(数据)中自我优化。 贝叶斯分类算法是机器学习算法之一。 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 有一家店铺,特征是“价位低、口味偏甜、距离远、评价4星、无促销”,他会在该店铺下单吗? 0 or 1 [0,1,1,4,0] 算法模型 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 历史经验 那么再回到这个问题,我们把贝叶斯定理告诉计算机,让计算机对历史数据进行模型训练,再告诉计算相应的阈值,从而模型就是可以对输入的特征数据进行类别判断。 10 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 python实现朴素贝叶斯算法 Scikit-learn库中的朴素贝叶斯分类器来实现 高斯朴素贝叶斯 GaussianNB() 多项式朴素贝叶斯 MultinomialNB() 伯努利朴素贝叶斯 BernoulliNB() Python是一门特别适合人工智能的语言,它有专门的机器学习的第三方库。 11 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 贝叶斯分类算法的其他应用 垃圾邮件过滤 文本情感分析 手写体数字识别 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 垃圾邮件特征提取 CountVectorizer() 下面那我们思考一下垃圾邮箱是如何进行模型训练的 接下来请同学们打开垃圾邮箱.py这个文件完善代码及测试 13 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 贝叶斯分类器的性能评估 样本数据 新的输入x 新的输出 贝叶斯分类器 模型 性能指标:准确率等 测试数据 结果准不准? 通过体验大家发现了我们的训练模型是不一定准确的,那么我们如何贝叶斯分类器模型进行性能评估呢,是的…. 大家想一想哪些因素会影响准确率? 数据的规模、模型(算法) 下面请同学们… 14 原理剖析 情境导入 算法实现 迁移应用 性能评估 评价与思考 利用机器学习解决问题的步骤 准备数据 使用训练集训练模型 使用测试集 评估模型性能 使用模型做预测 算力 算法 数据 经验为舟,算法为桨 贝叶斯分类器的原理与应用探秘 null 4623.683 null 6269.4043 null 6217.159 $Hi Peter, Sure thing. Sounds good. Let me know what time would be good for you. I will come prepared with some ideas and we can go from there. Regards, -Vivek. $Percocet 10/625 mg withoutPrescription 30 tabs - $225! Percocet, a narcotic analgesic, is used to treat moderate to moderately SeverePain Top Quality, EXPRESS Shipping, 100% Safe & Discreet & Private. Buy Cheap Percocet Online $

资源预览图

5.2人工智能的应用《贝叶斯分类器》课件 -2026-2027学年高中信息科技浙教版必修1
1
5.2人工智能的应用《贝叶斯分类器》课件 -2026-2027学年高中信息科技浙教版必修1
2
5.2人工智能的应用《贝叶斯分类器》课件 -2026-2027学年高中信息科技浙教版必修1
3
5.2人工智能的应用《贝叶斯分类器》课件 -2026-2027学年高中信息科技浙教版必修1
4
5.2人工智能的应用《贝叶斯分类器》课件 -2026-2027学年高中信息科技浙教版必修1
5
5.2人工智能的应用《贝叶斯分类器》课件 -2026-2027学年高中信息科技浙教版必修1
6
相关资源
示范课
由于学科网是一个信息分享及获取的平台,不确保部分用户上传资料的 来源及知识产权归属。如您发现相关资料侵犯您的合法权益,请联系学科网,我们核实后将及时进行处理。