Independent and Identically Distributed (i.i.d)

ML
Author

Nipun Batra

Published

March 18, 2025

import matplotlib.pyplot as plt
import numpy as np
print(np.__version__)
import torch 
import torch.nn as nn

import pandas as pd
# Retina mode
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
2.2.4
X1 = torch.distributions.Normal(0, 1)
X2 = torch.distributions.Normal(0, 1)
# say sample is
sample = torch.tensor([0.2, 0.4])
P_X_x1_ = X1.log_prob(sample[0]).exp()
P_X_x2_ = X2.log_prob(sample[1]).exp()

print(P_X_x1_, P_X_x2_)
tensor(0.3910) tensor(0.3683)
joint_pdf = P_X_x1_ * P_X_x2_
print(joint_pdf)
tensor(0.1440)