当前位置:网站首页>Chapter 13 Bayesian Network Practice
Chapter 13 Bayesian Network Practice
2022-08-06 07:06:00 【Sang Zhiwei 0208】
1 The derivation, application and classification of Naive Bayes
1.1 Derivation of Naive Bayes
Naive Bayes is a supervised learning algorithm that applies Bayes' theorem based on the naive assumption that "features are independent" (ie: the probability of one feature appearing is independent of other features).
For a given eigenvector
, the probability of the class
can be calculated according to BayerThe Sterling formula gets:

Use the naive independence assumption: 
With a given sample,
is a constant: 
Therefore
1.2 Applications of Naive Bayes
Naive Bayesian algorithm is widely used in real life, such as text classification, spam classification, credit evaluation, phishing website detection and so on.
1.3 Naive Bayesian Classification
- Gaussian Naive Bayes——
, use maximum likelihood estimation (MLE) for the parameters. - Multinomial Distribution Naive Bayes - For each class
, the parameter is
, where
is the number of features,
with probability
.The parameter
The result of using maximum likelihood estimation is:
,
.Assuming the training set is T, then
,Among them,
is called Laplace smoothing;
It is called Lidstone smoothing.
2 Processing flow of text data
(1) Crawl data
(2) Segment the text, which can be divided into Chinese word segmentation and English word segmentation. English word segmentation can be done with spaces, and Chinese word segmentation can be done by jieba word segmentation. Refer to https://blog.csdn.net/qwertyuiop0208/articleMethod 1 of text feature extraction in /details/125251521.
(3) Data preprocessing (including data cleaning and correction, etc.) refer to https://blog.csdn.net/qwertyuiop0208/article/details/125926133
(4) Standardize the data
(5) Convert strings into vectors by feature extraction methods such as TF-IDF or Word2vec.
(6) Modeling and model evaluation with algorithms such as machine learning.
3 Use TF-IDF to get text features
If a word or phrase has a high probability of appearing in a certain article and rarely appears in other articles, it is considered that the word or phrase has a good ability to distinguish between categories and is suitable for classification.TF-IDF is used to evaluate the importance of a word to a document or one of the documents in a corpus.
For details, see: https://blog.csdn.net/qwertyuiop0208/article/details/125251521.
4 Use of Word2vec
The essence is to establish a 3-layer neural network, map all words into vectors of a certain length; take a certain window range as the shower of the current word, and estimate the words in the window.It contains two algorithms, skip-gram and CBOW. The biggest difference between them is that skip-gram predicts the words around the center word through the center word, while CBOW predicts the center word through the surrounding words.
边栏推荐
猜你喜欢
随机推荐
内容翻译-内容高质量批量免费翻译
Chapter 13 贝叶斯网络实践
LeetCode50天刷题计划(Day 12—— 电话号码的字母组合(8.40-10.40)
翻译俄语的软件
多态,抽象方法,向上转型,向下转型
用tidyverse包做探索性数据分析,常用函数总结
接入华为游戏防沉迷,点击防沉迷弹窗后游戏闪退
overflow-y:auto的使用,div中内容超出指定高度,出现滚动条
ffmpeg RGB raw data H264 encoding to write mp4
【Simple use of zed camera】(2)
超好用R包(grafify)
tuxera NTFS2022让磁盘读写管理格式化更轻松
Unity屏幕坐标和世界坐标的转化
D. Epic Transformation
[Problem related solutions in SLAM]
更换oracle nls,Oracle更改客户端语言字符集设置NLS_LANG的方法
高并发、多线程、分布式都不懂,你拿什么跳槽阿里、腾讯、京东?还不好好学习啊
推荐系统-排序层-2018:DIN(Deep Interest Network)【Attention机制引入到CTR预估模型】【阿里】
卡片层叠Banner
find方法和 findIndex方法的使用
, use maximum likelihood estimation (MLE) for the parameters.
, where
is the number of features,
with probability
.The parameter
The result of using maximum likelihood estimation is:
,
.Assuming the training set is T, then
,Among them,
is called Laplace smoothing;
It is called Lidstone smoothing.








