กลับสู่คอร์สเรียน
AI018 มืออาชีพ

คู่มือผู้ใช้ NumPy

บทแนะนำเบื้องต้นอย่างละเอียดและคู่มือทางเทคนิคเกี่ยวกับ NumPy ครอบคลุมการติดตั้ง การจัดการอาร์เรย์ การดัชนี การกระจาย และการรวมกับภาษา C/C++

4.9
15.0h
891 ผู้เรียน
5 lessons
0 การถูกใจ
ปัญญาประดิษฐ์
เริ่มเรียน

ภาพรวมคอร์สเรียน

📚 สรุปเนื้อหา

บทแนะนำอย่างละเอียดและแนวทางทางเทคนิคเกี่ยวกับ NumPy ครอบคลุมการติดตั้ง การจัดการอาร์เรย์ การเข้าถึงข้อมูล การกระจาย (broadcasting) และการผสานรวมกับภาษา C/C++

จัดการพื้นฐานการคำนวณเชิงวิทยาศาสตร์ในภาษา Python ด้วยคู่มือ офици่ของ NumPy

ผู้เขียน: ชุมชน NumPy

ขอบคุณ: เขียนโดยชุมชน NumPy

🎯 เป้าหมายการเรียนรู้

  1. นิยามว่า NumPy คืออะไร และระบุบทบาทของมันในระบบนิเวศของ Python สำหรับงานวิทยาศาสตร์
  2. อธิบายเหตุผลที่ทำให้ NumPy เร็วกว่าลูปมาตรฐานใน Python โดยใช้แนวคิดของการเวกเตอร์ไรเซชัน (vectorization)
  3. ดำเนินการคำสั่งติดตั้งในสภาพแวดล้อมต่าง ๆ ได้ เช่น แพ็กเกจ Pip, Conda, และ Raspberry Pi
  4. ระบุและตีความคุณสมบัติหลักของ ndarray เช่น ndim, shape, และ dtype
  5. ดำเนินการสร้างและจัดการอาร์เรย์โดยใช้ฟังก์ชันต่าง ๆ เช่น linspace, reshape, vstack, และ hstack
  6. ประยุกต์ใช้การดำเนินการแบบองค์ประกอบ (elementwise operations), ฟังก์ชันทั่วไป (ufuncs) และเครื่องแก้ระบบพีชคณิตเชิงเส้นกับชุดข้อมูลเชิงตัวเลข
  7. จัดการความแม่นยำของข้อมูลและลดข้อผิดพลาดจากการเกินขอบเขต (overflow) โดยใช้ประเภทสเกลาร์ของ NumPy และเครื่องมือตรวจสอบข้อมูล (iinfo, finfo)
  8. นำเข้าข้อมูลจากดิสก์ได้อย่างยืดหยุ่นโดยใช้ genfromtxt พร้อมตั้งค่าตัวแบ่งข้อมูลเอง หัวข้อข้อมูล และเลือกคอลัมน์เฉพาะ
  9. ประยุกต์กฎการกระจายทั่วไป (General Broadcasting Rules) เพื่อคาดการณ์และควบคุมการโต้ตอบระหว่างอาร์เรย์ที่มีรูปร่างต่างกัน
  10. จัดการการอ้างอิงหน่วยความจำ และหลีกเลี่ยง "จุดพราง" ในคลาส ndarray ที่กำหนดเอง โดยใช้แอตทริบิวต์ .base

บทเรียน

Lesson

This lesson introduces NumPy as the foundational bridge between high-level Python applications and low-level hardware, focusing on the ndarray as a universal interface for scientific computing. Students will learn how the ndarray’s contiguous memory layout and homogeneous data structure enable high-performance, vectorized operations across the data science ecosystem.

This lesson introduces the NumPy ndarray as a memory-efficient, homogeneous alternative to Python lists, focusing on proper initialization and the performance benefits of contiguous memory. Students will learn to interpret core array attributes—such as shape, size, and data type—to understand how metadata defines the spatial geometry and memory footprint of numerical data.

This lesson covers precision management in NumPy, focusing on how fixed-size data types handle integer overflow and floating-point saturation. It also introduces robust data ingestion techniques using np.genfromtxt to handle irregular file formats and sanitize messy datasets.

This lesson explores the complexities of subclassing `numpy.ndarray`, focusing on the "Initialization Triad" and the critical role of the `__array_finalize__` hook in maintaining metadata. Students will learn to navigate the risks of behavioral fragility and identify when to choose subclassing for interoperability versus using composition for safer architectural design.

AI018: Extending NumPy with the C-API (Lesson 5) explores how to overcome performance bottlenecks like the interpreter tax and memory bloat by implementing high-performance C extensions. Students will learn to manage memory safely, utilize kernel fusion, and perform cache-aligned pointer arithmetic to optimize complex computational tasks.