iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 6
0
自我挑戰組

機器學習與數學天天玩系列 第 6

Day 6-機器學習與數學天天玩-PCA-Statistical Introduction: Covariance

The brief structure leading to the milestone of PCA is as below:

  1. Statistical Introduction
  2. Transformation of Vectors in Spaces
  3. Orthogonal Projectio

The course today gave us a new term, covariance.
What is covariance? Why do need to learn covariance?

In addition to observing the mean value and variance of a single dataset, to understand the relationsip between two datasets is another interesting facet.

Two datasets with the same variance and mean value may have positive or negative relationship or nothing to do with each other.

https://ithelp.ithome.com.tw/upload/images/20181009/20111554yd0P2XhLro.png

Below is the code to display the variance, mean value, covariance:

import numpy as np

array_a = np.arange(1, 8, 1)
array_b = np.arange(7, 0, -1)

var_a, var_b = np.var(array_a), np.var(array_b)
print("Variance for dataset a and b")
print(var_a, var_b)

mean_a, mean_b = np.average(array_a), np.average(array_b)
print("Mean Value for dataset a and b")
print(mean_a, mean_b)

cov_a_b = np.cov(array_a, array_b)
print("Covariance for dataset a and b")
print(cov_a_b)

上一篇
Day 5-機器學習與數學天天玩-PCA-Statistical Introduction: Welford’s Method
下一篇
Day 7-機器學習與數學天天玩-PCA-Statistical Introduction: Linear Transformation
系列文
機器學習與數學天天玩13
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言