<jupyter_start><jupyter_text>Aplication of AI:    - Speech recognation    - NLP    - Image recognation<jupyter_code># # ML
# Provides computers with the ability to learn without being explicitly programmed<jupyter_output><empty_output><jupyter_text>Limitation of mL    -<jupyter_code># Make a vector in numpy
import numpy as np


v = np.array([5, 2, 1])

print(v)

print(v.shape)
v[1]
v.shape

v = np.array([[5, 2, 1]])

# print(v)

print(v.shape)
v_t = np.transpose(v)
print(v_t)
v_t.shape # (3, 1) = (row, column)
v[0]
v[0][1]
# in DS-2.2 our input should 2d array
# Make a matrix

matrix = np.array([[1,2,3], [2, 0, 1]])

print(matrix)

print(matrix.shape)

print(matrix.size) # size is number of elements
matrix_t = np.transpose(matrix)
print(matrix_t)

print(matrix_t.shape)

print(matrix_t.size)
# Arrange or reshape the matrix (2D array or 2D Tensor)

v_2 = np.array([[1,2,3], [2, 0, 1]])

print("just a reshape like transpose: ",v_2.reshape(3, 2))

# By applying the following reshape we transform the amtrix into 3D Tenosor

print("Specified 1st parameter: ",v_2.reshape(3, 1, 2))
print("UNSpecified 1st parameter: ", v_2.reshape(-1, 1, 2))
# Make a 3D Tensor in numpy
v = np.array([[[1., 2.,3.], [4.,5.,6.]], [[7.,8.,9.], [11.,12.,13.]]])

print(v)

# The first element of shape shows how many, and the second and third elements shows the dimension
print(v.shape)
print(v[0])
print(v[1])
# print(v[2]) this gives error because we have only 2 depth
print(v.size) # 12
print(v.reshape(3, 2, -1)) # this equals to v.reshape(3, 2, 2)
print(v.reshape(3, 1, -1))
print(v.reshape(3, -1, 1)) # we want one column and '-1' is '4' here which is the num of rows
# Make a 4D Tensor Matrix

v_4 = np.zeros((2, 3, 5, 5))
print(v_4)
# Make 5D Tensor in numpy
v_5 = np.zeros((2, 2, 3, 5, 5)) # 2 by 2 and depth is 3 and the 5 by 5
print(v_5)
print(v[0][0].shape)
print(v[0][1].shape)
print(v[1][0].shape)
print(v[1][1].shape)
# Matrix Multiplication

a = np.array([[4,2,3], [2,0,1]])

# flip the array
b = np.transpose(a)
# find the dot product of a and b
c = np.dot(a, b)

print(c)
d = np.dot(b, a)
print(d)

# dot product of a and b is not the same is dot product of b and a!!!!
# Element-wise multiplication of matrix
# 1st observation do Element-wise multiplication the matrix should be same deminsion
# 2nd observation it is commututive
a = np.array([[1, 2], [3, 4]])
b = np.array([[5, 6], [7, 8]])
print(np.multiply(a,b))
print(np.multiply(a,b))
print(a*b)
print(b*a)<jupyter_output>[[ 5 12]
 [21 32]]
[[ 5 12]
 [21 32]]
[[ 5 12]
 [21 32]]
[[ 5 12]
 [21 32]]
{'fraction_non_alphanumeric': 0.17200938232994528, 'fraction_numerical': 0.05942142298670837, 'mean_word_length': 4.243852459016393, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '23158', 'license': 'MIT', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1057, 'n_words': 337, 'path': 'Notebooks/array_matrix_manipulation.ipynb', 'repo_name': 'Sukhrobjon/DS-2.2-DL', 'size': '2558'}