Machine Learning on Bitcoin
Using Singular Value Decomposition as an Example
We show how machine learning techniques can be applied in Bitcoin, inspired by the latest Bitcoin Class. Specifically, we demonstrate how Singular Value Decomposition (SVD) can be applied to enable trustless purchase of an original image, based on a low-resolution preview.
Singular Value Decomposition (SVD)
SVD is a type of matrix decomposition that decomposes/factors a single matrix into matrix U, ∑ and V* respectively.
- U and V* are orthogonal matrices.
- ∑ is a diagonal matrix of singular values.
Intuitively, it can be seen as converting one complex transformation in 3 simpler transformations (rotation, scaling, and rotation), in which
- Matrices U and V* causes rotation
- Diagonal matrix ∑ causes scaling.
A typical machine learning problem might have several hundred or more variables, while many machine learning algorithms will break down if presented with more than a few dozen. This makes singular value decomposition indispensable in ML for variable reduction.
SVD with a reduced number of singular values can closely approximate a matrix, thus allows us to express our original matrix as a linear combination of low-rank matrices. Below, we show an original high-quality image, along with its compressed version with 160, 40, and 10 singular values, respectively. As can be seen, the more singular values we retain, the closer we get to the original image.
Sell higher-resolution image
A photographer wants to sell his work. He posts a blurred version online, for example, the third image of Triton above. After seeing the preview, some interested buyer can lock up some funds in the following contract, where A is the preview image. Only a higher-quality image, whose SVD can unlock it and redeem the funds. The buyer can reconstruct the clearer image by computing U*∑*V, after seller unlocks it. This purchase is enforced by the Bitcoin network and thus atomic.
The contract can be easily modified such that the higher quality an image is, the higher price it is required to access. Also the data can be other types of digital items such as video, climate, or financial data.
SVD has many other applications, besides data compression. The above contract can be generalized to them.
We have only demonstrated one use case of ML in Bitcoin. The same principle can be easily extended for many other machine learning applications.