<jupyter_start><jupyter_text>Learn numpy basics including array creation and slicing<jupyter_code>import numpy as np
a = np.array([1, 2, 3])
a
np.zeros(2)
np.ones(2)
np.arange(4)
np.arange(0, 9, 2)
np.linspace(0, 10, num=5)
np.ones(2, dtype=np.int64)
a = np.array([[1, 2], [3, 4]])
b = np.array([5, 6])
display(a)
display(b[np.newaxis, :])
np.concatenate((a, b[np.newaxis, :]))
arr = np.arange(3)
arr.shape
row_vector = arr[np.newaxis, :]
row_vector.shape
col_vector = arr[:, np.newaxis]
col_vector.shape<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19288389513108614, 'fraction_numerical': 0.04307116104868914, 'mean_word_length': 5.9480519480519485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '394528', 'license': 'MIT', 'n_tokens_mistral': 255, 'n_tokens_neox': 244, 'n_words': 49, 'path': 'Regression from scratch/numpy_basics.ipynb', 'repo_name': 'niloysh/machine-learning', 'size': '534'}