np.linalg.norm() से Norm निकालना
एक norm एक vector या matrix की length या size को एक single number की तरह measure करता है।
In this page:
Syntax
length = np.linalg.norm(vector)
np.linalg.norm(vector, ord=p)
np.linalg.norm()
Default से norm एक vector की Euclidean (L2) length compute करता है, squares के sum का square root। ord argument अन्य norms select करता है जैसे 1 (absolute values का sum) या np.inf (सबसे बड़ी absolute value)।
Norms distances और error measurements के लिए इस्तेमाल होते हैं।
Note:
दो points के बीच distance norm(a - b) है।
उदाहरण: np.linalg.norm()
import numpy as np
v = np.array([3, 4])
print(np.linalg.norm(v))
print(np.linalg.norm(v, ord=1))
print(np.linalg.norm(np.array([1, 2]) - np.array([4, 6])))
# Output:
# 5.0
# 7.0
# 5.0
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- यह भूल जाना कि ord definition बदलता है
- vector और matrix norms confuse करना
- एक distance measure करने से पहले subtract न करना
चैप्टर सारांश
- Default L2 norm है
- ord norm type select करता है
- Distance difference के norm के बराबर है
- Vectors और matrices पर काम करता है
🔒
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: