Normalize ข้อมูล list เบื้องต้น
เมื่อเข้าใจเรื่อง normalization แล้ว ลองนำมาใช้กับข้อมูลจริงกัน goals_for คือ list ของจำนวนประตูที่ทีมฟุตบอลทำได้ใน 10 นัดหลังสุด ใช้ฟังก์ชัน whiten() เพื่อ standardize ข้อมูลชุดนี้
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การวิเคราะห์กลุ่มข้อมูลใน Python
คำแนะนำการฝึกหัด
- Import ฟังก์ชัน
whiten - ใช้ฟังก์ชัน
whiten()เพื่อ standardize ข้อมูล
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Import the whiten function
from scipy.cluster.vq import ____
goals_for = [4,3,2,3,1,1,2,0,1,4]
# Use the whiten() function to standardize the data
scaled_data = ____(____)
print(scaled_data)