产生式模型与判别式模型

一、产生式模型(Generative model)概念(来自wiki)

       In probability and statistics, a generative model is a model for randomly generating observable data, typically given some hidden parameters. It specifies a joint probability distribution over observation and label sequences. Generative models are used in machine learning for either modeling data directly (i.e., modeling observations drawn from aprobability density function), or as an intermediate step to forming a conditional probability density function. A conditional distribution can be formed from a generative model through Bayes' rule.

二、常见产生式模型

    1. Gaussian mixture model and other types of mixture model
    2. Hidden Markov model
    3. Probabilistic context-free grammar
    4. Naive Bayes
    5. Averaged one-dependence estimators
    6. Latent Dirichlet allocation
    7. Restricted Boltzmann machine

三、判别式模型(Discriminative model)概念(来自wiki)

Discriminative models, also called conditional models, are a class of models used in machine learning for modeling the dependence of an unobserved variable y on an observed variable x. Within a probabilistic framework, this is done by modeling the conditional probability distribution P(y|x), which can be used for predicting y from x.

四、常见的判别式模型

  1.  Logistic regression, a type of generalized linear regression used for predicting binary or categorical outputs (also known as maximum entropy classifiers)
  2. Linear discriminant analysis
  3. Support vector machines
  4. Boosting (meta-algorithm)
  5. Conditional random fields
  6. Linear regression
  7. Neural networks
### 李宏毅讲解生成式模型判别式模型 #### 生成式模型的特点 生成式模型旨在捕捉数据的真实分布,通过学习联合概率分布 \( p(x, y) \),其中 \( x \) 是输入特征而 \( y \) 是类别标签。这类模型能够模拟新样本的创建过程,适用于多种任务如图像合成、语音生成等[^3]。 对于分类问题而言,在应用贝叶斯定理时,可以通过寻找一组合适的高斯函数来构建模型集合,并利用最大似然估计方法评估各个候选模型的质量从而挑选最优者[^2]。 #### 判别式模型的工作原理 相比之下,判别式模型专注于建立条件概率分布 \( p(y|x) \),即给定特定输入下预测输出的概率。典型代表有支持向量机和支持向量网络等算法。这些技术并不试图理解整个系统的运作机制而是直接针对决策边界进行优化以实现高效准确地分类目的[^4]。 #### Flow作为一种特殊的生成式模型 值得注意的是Flow也属于生成式模型的一种形,它其他同类框架(例如GANs和VAEs)共享相似属性——都是为了创造逼真的假象实例而设计出来的工具[^1]。 ```python import numpy as np from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB # 创建虚拟二元分类数据集 X, y = make_classification(n_samples=1000, n_features=20, random_state=42) # 将数据分为训练集和测试集 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42) # 使用朴素贝叶斯作为简单的生成式模型示例 gnb = GaussianNB() gnb.fit(X_train, y_train) print(f"Test set accuracy: {gnb.score(X_test, y_test):.2f}") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值