ディリクレ分布とは
ディリクレ分布とは、
ディリクレ分布の確率密度関数は次の式で表されます。
上式において
ディリクレ分布の期待値と分散
ディリクレ分布の期待値、分散はそれぞれ以下になります。
パラメータの影響を確認
3次元(
import numpy as np
from scipy import special
from scipy.stats import dirichlet
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot')
class Dirichlet():
def __init__(self, param: list) -> None:
self.param = np.array(param)
def pdf(self, x: list) -> np.float:
x_ar = np.array(x)
cons = np.prod(special.gamma(self.param))/(special.gamma(np.sum(self.param)))
p = (1./cons) * np.prod(x_ar**(self.param-1))
return p
def plt_3d(self, nrow: int, ncol: int, n: int, zlim=None)->None:
xdata = np.linspace(0, 1, 200)
ydata = np.linspace(0, 1, 200)
X,Y = np.meshgrid(xdata, ydata)
z = []
X[X+Y>1] = 0
Y[X+Y>1] = 0
for _x, _y, _z in zip(X.flatten(), Y.flatten(), (1-X-Y).flatten()):
z.append(self.pdf([_x, _y, _z]))
Z = np.array(z).reshape(X.shape)
fig = plt.figure(figsize=(10, 3))
ax = plt.axes(projection='3d')
ax.plot_surface(X, Y, Z, cmap='plasma')
ax.set_zlim(zlim)
ax.set_xlabel("$x_1$")
ax.set_ylabel("$x_2$")
ax.set_zlabel("PDF")
ax.set_title("Dir($\\vec{\\alpha} = $" + "%s)" % self.param)
plt.show()
Dirichlet([1.,1.,1.]).plt_3d(2, 2, 1, zlim=(0, 2.1))
Dirichlet([5.,5.,5.]).plt_3d(2, 2, 2)
Dirichlet([5.,1.,1.]).plt_3d(2, 2, 3)
Dirichlet([1.,5.,1.]).plt_3d(2, 2, 2)
3つの
AlloyDB
Amazon Cognito
Amazon EC2
Amazon ECS
Amazon QuickSight
Amazon RDS
Amazon Redshift
Amazon S3
API
Autonomous Vehicle
AWS
AWS API Gateway
AWS Chalice
AWS Control Tower
AWS IAM
AWS Lambda
AWS VPC
BERT
BigQuery
Causal Inference
ChatGPT
Chrome Extension
CircleCI
Classification
Cloud Functions
Cloud IAM
Cloud Run
Cloud Storage
Clustering
CSS
Data Engineering
Data Modeling
Database
dbt
Decision Tree
Deep Learning
Descriptive Statistics
Differential Equation
Dimensionality Reduction
Discrete Choice Model
Docker
Economics
FastAPI
Firebase
GIS
git
GitHub
GitHub Actions
Google
Google Cloud
Google Search Console
Hugging Face
Hypothesis Testing
Inferential Statistics
Interval Estimation
JavaScript
Jinja
Kedro
Kubernetes
LightGBM
Linux
LLM
Mac
Machine Learning
Macroeconomics
Marketing
Mathematical Model
Meltano
MLflow
MLOps
MySQL
NextJS
NLP
Nodejs
NoSQL
ONNX
OpenAI
Optimization Problem
Optuna
Pandas
Pinecone
PostGIS
PostgreSQL
Probability Distribution
Product
Project
Psychology
Python
PyTorch
QGIS
R
ReactJS
Regression
Rideshare
SEO
Singer
sklearn
Slack
Snowflake
Software Development
SQL
Statistical Model
Statistics
Streamlit
Tabular
Tailwind CSS
TensorFlow
Terraform
Transportation
TypeScript
Urban Planning
Vector Database
Vertex AI
VSCode
XGBoost