左邊圖形大小為 3900 * 2600 像素。
使用 Google 搜尋 svd python image compression,就可以找到上述網頁,幾行程式完成一個禮拜的數學課程!透過線性代數的奇異值分解 (singular value decomposition),取出前面 50 組向量和奇異值,形成右邊圖形,只需要原始資料 3.2% 的空間。也就是說,(網路) 傳輸時間節省了 96.8% 的成本。也是重要的問題 (1, 2)。
- 3Blue1Brown, Essence of linear algebra (Amazing videos)
- Stephen Boyd and Lieven Vandenberghe, Vectors, Matrices, and Least Squares, 2017. (An excellent review of matrix operations and many applications in data science. The book webpage contains the link to Python codes.) (EE at Stanford and UCLA)
- Robert Johansson, Numerical Python: Scientific computing and data science applications with Numpy, SciPy and Matplotlib (CYCU 電子書)
- Strang, Gilbert. Linear Algebra and Learning from Data. Wellesley-Cambridge Press, 2018. (infor, course)
- Makoto Tsukada et al., Linear Algebra with Python: Theory and Applications, Springer Nature eBook., 2023. (CYCU 電子書) (new)
(2) Life is short, learn Python!
import numpy as np
import time
beginning = time.time()
random_array = np.random.rand(200, 200) # 200 by 200 matrix!
eigenvalues, eigenvectors = np.linalg.eig(random_array)
print( time.time() - beginning ) # 0.04667830467224121 second
eigenvalues
沒有留言:
張貼留言