Numpy - operations
Greetings! I'm Vishnu Vinay, a Computer Science and Engineering graduate holding a B. Tech degree. Currently immersed in the captivating world of Artificial Intelligence, I am on a quest for knowledge while pursuing a graduate certificate in Artificial Intelligence with Machine Learning. My passion lies in sharing insights and discoveries in the fields of AI, Machine Learning, Artificial General Intelligence, and Robotics through engaging blog posts. Proficient in Python, ML libraries, and algorithms, I find joy in developing and deploying ML models, with a focus on leveraging AWS Sagemaker. Join me on this exciting journey of unraveling the mysteries of AI through the lens of coding, exploration, and the ever-evolving landscape of machine learning. Let's embark on this knowledge-sharing adventure together!
import numpy as np
a = np.array([1, 2, 3])
b = np.array([5, 6, 7])
1) Performs element-wise operations
print(a + 2)
print(a 3)*
print(a ** 2)
print(a / 2)
print(a % 2)
print(a + b)
[3 4 5]
[3 6 9]
[1 4 9]
[0.5 1. 1.5]
[1 0 1]
[ 6 8 10]
Note: in case of (a + b) -> both must be of the same dimensions or will throw an error
2) Some common built-in functions
print(a.mean())
print(b.sum())
/ Dot operation
a1_2d = np.array([[1, 2], [3, 4]])
a2_2d = np.array([[10, 20], [30, 40]])
a1_2d.dot(a2_2d)
2.0
18
array([[ 70, 100],
[150, 220]])
Note: there are a lot more other built-in functions but these two are the most used