<jupyter_start><jupyter_text>Network```X         W[[1, 2, 3, n]       [[1 2 3 4] [1, 2, 3, n]        [1 2 3 4] [1, 2, 3, n]        [1 2 3 4] [1, 2, 3, n]]        [1 2 3 4]]```<jupyter_code>import numpy as np

X = np.array([
    [
        [1, 1, 1, 1],
        [2, 2, 2, 2],
        [3, 3, 3, 3]
    ],
    [
        [4, 4, 4, 4],
        [5, 5, 5, 5],
        [6, 6, 6, 6]
    ]
])<jupyter_output><empty_output><jupyter_text>The matrix X is an array of matrices.The shape is `(2, 3, 4)` which means:  * 2 matrices of  * 3 rows of 4 columns<jupyter_code>print(X.shape)<jupyter_output>(2, 3, 4)<jupyter_text>What we want is to pressent each row as a column, i.e```[[1, 2, 3, n] [1, 2, 3, n] [1, 2, 3, n] [1, 2, 3, n]]```<jupyter_code>print(X[0].T)
print(X[0].T.shape)<jupyter_output>[[1 2 3]
 [1 2 3]
 [1 2 3]
 [1 2 3]]
(4, 3)<jupyter_text>This is a `(4, 3)` matix, the weight should be a `(3, 4)` matrix.```[1 2 3 ...][1 2 3 ...][1 2 3 ...]```i.e `(3, m)`X.dot(W)<jupyter_code>W = np.array([
    [1, 1, 1, 1],
    [1, 1, 1, 1],
    [1, 1, 1, 1]
])

print(W.shape)<jupyter_output>(3, 4)<jupyter_text>X is a (m, 4) matrix<jupyter_code>X_1 = X[0].T
# importtant that W is first
A_1 = np.dot(W, X_1)
print(X_1)
print(W)
print(A_1)<jupyter_output>[[1 2 3]
 [1 2 3]
 [1 2 3]
 [1 2 3]]
[[1 1 1 1]
 [1 1 1 1]
 [1 1 1 1]]
[[ 4  8 12]
 [ 4  8 12]
 [ 4  8 12]]
{'fraction_non_alphanumeric': 0.22551928783382788, 'fraction_numerical': 0.11869436201780416, 'mean_word_length': 2.540682414698163, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '322925', 'license': 'MIT', 'n_tokens_mistral': 796, 'n_tokens_neox': 674, 'n_words': 215, 'path': 'coursera/deeplearning/week3/week3.ipynb', 'repo_name': 'gerritjvv/deeplearning', 'size': '1348'}