<jupyter_start><jupyter_text>Problem 1 - Linear Separability<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D<jupyter_output><empty_output><jupyter_text>Class 1: (-1, -1), (1, 1), (-3, -3), (4, 4)<jupyter_code>class1_x1 = [-1, 1, -3, 4]
class1_x2 = [-1, 1, -3, 4]<jupyter_output><empty_output><jupyter_text>Class 2: (-1, 1), (1, -1), (-5, 2), (4, -8)<jupyter_code>class2_x1 = [-1, 1, -5, 4]
class2_x2 = [1, -1, 2, -8]
plt.scatter(class1_x1, class1_x2, c = 'b')
plt.scatter(class2_x1, class2_x2, c = 'r')
plt.xlabel('x1')
plt.ylabel('x2')
plt.show()
plt.scatter(class1_x1, class1_x2, c = 'b')
plt.scatter(class2_x1, class2_x2, c = 'r')
plt.xlabel('x1')
plt.ylabel('x2')
plt.plot([class2_x1[0],class2_x1[1]], [class2_x2[0],class2_x2[1]], color='r')
plt.plot([class2_x1[1],class2_x1[3]], [class2_x2[1],class2_x2[3]], color='r')
plt.plot([class2_x1[2],class2_x1[3]], [class2_x2[2],class2_x2[3]], color='r')
plt.plot([class2_x1[0],class2_x1[2]], [class2_x2[0],class2_x2[2]], color='r')
plt.plot([class1_x1[2],class1_x1[3]], [class1_x2[2],class1_x2[3]], color='b')
plt.show()<jupyter_output><empty_output><jupyter_text>Define z = x1 * x2<jupyter_code>class1_z = [class1_x1[i] * class1_x2[i] for i in range(len(class1_x1))]
class2_z = [class2_x1[i] * class2_x2[i] for i in range(len(class2_x1))]
x1 = np.array(class1_x1)
y1 = np.array(class1_x2)
z1 = np.array(class1_z)
x2 = np.array(class2_x1)
y2 = np.array(class2_x2)
z2 = np.array(class2_z)
z2
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.scatter(x1, y1, z1, color='b')
ax.scatter(x2, y2, z2, color='r')
 
plt.show()
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.scatter(x1, y1, z1, color='b')
ax.scatter(x2, y2, z2, color='r')
ax.scatter(np.random.rand(20000)*20-10, np.random.rand(20000)*20-10, 0, color = 'y')
 
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21752903907074975, 'fraction_numerical': 0.10084477296726505, 'mean_word_length': 6.928870292887029, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '166154', 'license': 'MIT', 'n_tokens_mistral': 1012, 'n_tokens_neox': 965, 'n_words': 152, 'path': 'Assignment1/question1.ipynb', 'repo_name': 'IrohXu/NYU_Intro_to_Deep_Learning_System', 'size': '1894'}