標準差與變異數
正如影片中提到的,標準差是變異數的平方根。你將自己驗證這點:使用 np.std() 計算標準差,並與先用 np.var() 計算變異數後再取平方根的結果相比較。
本練習屬於課程
Statistical Thinking in Python (Part 1)
練習說明
- 使用
np.var()計算versicolor_petal_length陣列中資料的變異數,並存入名為variance的變數。 - 印出此值的平方根。
- 使用
np.std()印出versicolor_petal_length陣列中資料的標準差。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Compute the variance: variance
# Print the square root of the variance
# Print the standard deviation