<jupyter_start><jupyter_text>Q1. Generate N = 500 2-dimensional data points that are distributed according to the Gaussian distribution N(m,S), with mean m = [0, 0] T and covariance matrix>$S = \begin{bmatrix}\sigma_1^2 &  \sigma_{12} \\\sigma_{12} &  \sigma_2^2 \\\end{bmatrix}$For the following cases,>$\sigma_1^2 = 0.2, \sigma_2^2 = 2, \sigma_{12} = 0$>$\sigma_1^2 = 2, \sigma_2^2 = 0.2, \sigma_{12} = 0$>$\sigma_1^2 = 1, \sigma_2^2 = 1, \sigma_{12} = 0.5$>$\sigma_1^2 = 0.3, \sigma_2^2 = 2, \sigma_{12} = 0.5$>$\sigma_1^2 = 0.3, \sigma_2^2 = 2, \sigma_{12} = -0.5$Plot the generated numbers to visualize the distributions.<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

# plot 1
mean = [0,0]
cov = [[0.2, 0], [0, 2]] 
x = [val for val in range(500)]
a = np.random.multivariate_normal(mean, cov, 500)
y = a[:,0]
z = a[:,1]
fig = plt.figure()
ax = fig.add_subplot(111,projection = '3d')
ax.scatter(x,y,z, c='r', marker ='o')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('2D Data Points according to N(m,S), m = [0,0], S = [[0.2, 0], [0, 2]]')
plt.show()

# plot 2

mean = [0,0]
cov = [[2,0], [0, 0.2]] 
x = [val for val in range(500)]
a = np.random.multivariate_normal(mean, cov, 500)
y = a[:,0]
z = a[:,1]
fig = plt.figure()
ax = fig.add_subplot(111,projection = '3d')
ax.scatter(x,y,z, c='r', marker ='o')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('2D Data Points according to N(m,S), m = [0,0], S = [[2,0], [0, 0.2]] ')
plt.show()
# plot 3

mean = [0,0]
cov = [[1,0.5], [0.5, 1]] 
x = [val for val in range(500)]
a = np.random.multivariate_normal(mean, cov, 500)
y = a[:,0]
z = a[:,1]
fig = plt.figure()
ax = fig.add_subplot(111,projection = '3d')
ax.scatter(x,y,z, c='r', marker ='o')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('2D Data Points according to N(m,S), m = [0,0], S = [[1,0.5], [0.5, 1]] ')
plt.show()
# plot 4

mean = [0,0]
cov = [[0.3,0.5], [0.5, 2]] 
x = [val for val in range(500)]
a = np.random.multivariate_normal(mean, cov, 500)
y = a[:,0]
z = a[:,1]
fig = plt.figure()
ax = fig.add_subplot(111,projection = '3d')
ax.scatter(x,y,z, c='r', marker ='o')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('2D Data Points according to N(m,S), m = [0,0], S = [[0.3,0.5], [0.5, 2]]  ')
plt.show()
# plot 5

mean = [0,0]
cov = [[0.3,-0.5], [-0.5, 2]] 
x = [val for val in range(500)]
a = np.random.multivariate_normal(mean, cov, 500)
y = a[:,0]
z = a[:,1]
fig = plt.figure()
ax = fig.add_subplot(111,projection = '3d')
ax.scatter(x,y,z, c='r', marker ='o')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('2D Data Points according to N(m,S), m = [0,0], S = [[0.3,-0.5], [-0.5, 2]]')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2434376123696512, 'fraction_numerical': 0.07802948579647609, 'mean_word_length': 4.3810444874274665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '557879', 'license': 'MIT', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1309, 'n_words': 309, 'path': 'src/question_1.ipynb', 'repo_name': 'ajaybiswas22/Naive-Bayes-Classifier', 'size': '2781'}