【LDA学习系列】Dirichlet分布python代码
生活随笔
收集整理的這篇文章主要介紹了
【LDA学习系列】Dirichlet分布python代码
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
代碼:
# -*- coding: utf-8 -*- ''' Created on 2018年5月15日 @author: user @attention: dirichret distribution ''' from scipy.stats import dirichlet import matplotlib.pyplot as plt import numpy as npTOL = 1.48e-8def test_dirichret_distribution():print (dirichlet.pdf([0.6,0.3,0.1],[3,2,1]))print (dirichlet.logpdf([0.6,0.3,0.1],[1,2,3]))if __name__ == '__main__': #scipy.stats庫test_dirichret_distribution()#beta分布#pip install dirichlet #https://github.com/ericsuh/dirichlet結果:
6.479999999999995 -1.7147984280919264總結
以上是生活随笔為你收集整理的【LDA学习系列】Dirichlet分布python代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【LDA学习系列】Beta分布Pytho
- 下一篇: 【LDA学习系列】Gibbs采样pyth