目录
- 0 写在前面
- 1 贝叶斯方法
- 2 贝叶斯风险
- 3 从例子出发
- 4 朴素贝叶斯分类
* - 4.1 核心原理
- 4.2 拉普拉斯平滑
- 5 Python实现
* - 5.1 计算类先验概率
- 5.2 计算类后验概率
- 5.3 预测
; 0 写在前面
机器学习强基计划注重深度和广度,加深对机器学习模型的理解和应用。《深度》详细推导了算法模型背后的数学原理;《广》分析了几种机器学习模型:决策树、支持向量机、贝叶斯和马尔可夫决策、强化学习等。
[En]
The strong base plan for machine learning focuses on depth and breadth to deepen the understanding and application of machine learning models. “Deep” deduces the mathematical principles behind the algorithm model in detail; “Guang” analyzes several machine learning models: decision tree, support vector machine, Bayesian and Markov decision, reinforcement learning and so on.
从这一部分开始,我们正式进入贝叶斯模型。贝叶斯模型属于概率图模型的范畴。在逻辑推理中有大量的应用–专家系统、推荐系统等,但同时理论上也比较困难。本文首先为基本的贝叶斯方法奠定了基础,然后通过实例介绍了朴素贝叶斯的概念。
[En]
From this section, we formally enter the Bayesian model. Bayesian model belongs to the category of probability graph model. There are a large number of applications in logical inference-expert system, recommendation system, etc., but at the same time, the theory is more difficult. This paper first lays the groundwork for the basic Bayesian method, and then introduces the concept of naive Bayesian with an example.
Original: https://blog.csdn.net/FRIGIDWINTER/article/details/126963267
Author: Mr.Winter`
Title: 机器学习强基计划4-3:详解朴素贝叶斯分类原理(附例题+Python实现)
相关阅读
Title: leetcode 148. Sort List 排序链表(中等)
给你链表的头结点 head ,请将其按 升序 排列并返回 排序后的链表 。
示例 1:
输入:head = [4,2,1,3]
输出:[1,2,3,4]
示例 2:
输入:head = [-1,5,3,4,0]
输出:[-1,0,3,4,5]
示例 3:
输入:head = []
输出:[]
提示:
- 链表中节点的数目在范围 [0, 5 * 104] 内
- -105
进阶:你可以在 O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序吗?
使用快慢指针将列表分为两部分,对两部分进行递归排序,然后合并排序后的列表。
[En]
Use the fast and slow pointer to divide the list into two parts, sort the two parts recursively, and then merge the sorted list.
3.1 Java实现
class Solution {
public ListNode sortList(ListNode head) {
if (head == null || head.next == null) {
return head;
}
// 使用快慢指针找出中间节点,将链表一分为二
ListNode slow = head;
ListNode fast = head.next;
while (fast != null && fast.next != null) {
fast = fast.next.next;
slow = slow.next;
}
ListNode mid = slow.next;
slow.next = null;
return merge(sortList(head), sortList(mid));
}
ListNode merge(ListNode l1, ListNode l2) {
ListNode dummy = new ListNode();
ListNode tail = dummy;
while (l1 != null && l2 != null) {
if (l1.val > l2.val) {
tail.next = l2;
l2 = l2.next;
} else {
tail.next = l1;
l1 = l1.next;
}
tail = tail.next;
}
if (l1 != null) {
tail.next = l1;
}
if (l2 != null) {
tail.next = l2;
}
return dummy.next;
}
}
- 2022/9/3 要与邻里打好交道,远亲不如近邻呀
Original: https://www.cnblogs.com/okokabcd/p/16655667.html
Author: okokabcd
Title: leetcode 148. Sort List 排序链表(中等)
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/282605/
转载文章受原作者版权保护。转载请注明原作者出处!