<jupyter_start><jupyter_text>Linear scratch$${x}_1+x_2=2200$$$$1.5x_1+4x_2=5050$$<jupyter_code>import numpy as np
import numpy.linalg
import random

from datetime import datetime

A = np.array([[1, 1], [1.5, 4]])
b = np.array([2200, 5050])
np.linalg.solve(A, b)
5 * np.ones((2,3))<jupyter_output><empty_output><jupyter_text><jupyter_code>np.random.random((2,3))
np.random.randn(2,3)<jupyter_output><empty_output><jupyter_text>Do a speed test for matrix multiplications using lists, and using numpy<jupyter_code>width, height = 18**2, 12**2
py_matrix_1 = [[random.randint(1,9) for x in range(width)] for y in range(height)]
py_matrix_2 = [[random.randint(1,9) for x in range(height)] for y in range(width)]
#py_matrix_1 = [[12, 7, 3], 
#    [4, 5, 6], 
#    [7, 8, 9]] 
  
# take a 3x4 matrix     
#py_matrix_2 = [[5, 8, 1, 2], 
#    [6, 7, 3, 0], 
#    [4, 5, 9, 1]] 
      
#py_matrix_1 = [[1,2,3], [4,5,6]]
#py_matrix_2 = [[7,8], [9,10], [11,12]]

result = [[0 for x in range(len(py_matrix_2[0]))] for y in range(len(py_matrix_1))]

start_time = datetime.now()
# by row of first array
for i in range(len(py_matrix_1)):
  # by column of second array
  for j in range(len(py_matrix_2[0])):
    # by row of second array in the single column
    for k in range(len(py_matrix_2)):
      result[i][j] += py_matrix_1[i][k] * py_matrix_2[k][j]

end_time = datetime.now()
print('Duration: {}'.format(end_time - start_time))

py_matrix_1=numpy.array([numpy.array(xi) for xi in py_matrix_1])
py_matrix_2=numpy.array([numpy.array(xi) for xi in py_matrix_2])

start_time = datetime.now()

py_matrix_1.dot(py_matrix_2)
end_time = datetime.now()
print('Duration: {}'.format(end_time - start_time))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.176196032672112, 'fraction_numerical': 0.061843640606767794, 'mean_word_length': 5.213768115942029, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '282690', 'license': 'CC0-1.0', 'n_tokens_mistral': 770, 'n_tokens_neox': 732, 'n_words': 163, 'path': 'numpy_deep_learning_scratch.ipynb', 'repo_name': 'karlmutch/udemy', 'size': '1714'}