Author Archives: wdengquantum.me

PyTorch Fundamentals (Part \(2\))

Problem: Do an end-to-end walkthrough of the PyTorch machine learning workflow using the most basic univariate linear regression example. In particular, generate some linear data over a normalized feature space (whose slope \(w\) and intercept \(b\) would in practice be … Continue reading

Posted in Blog | Leave a comment

PyTorch Fundamentals (Part \(1\))

Problem: Illustrate some of the basic fundamentals involved in using the PyTorch deep learning library. In particular, discuss the attributes of PyTorch tensors (e.g. dtype, CPU/GPU devices, etc.), how to generate random PyTorch tensors with/without seeding, and operations that can … Continue reading

Posted in Blog | Leave a comment

Tokenization & Transformers

Problem: Let \(|\mathcal V|,N_c\in\mathbf Z^+\) be positive integers (where \(|\mathcal V|\) is the cardinality of an arbitrary set \(\mathcal V\) called the vocabulary and \(N_c\) will come to be seen as the number of codebooks), and let \(\mathcal T\) be … Continue reading

Posted in Blog | Leave a comment

JAX Fundamentals (Part \(1\))

JAX_tutorial $\textbf{Problem}$: What is JAX? $\textbf{Solution}$: JAX = Autograd + XLA, where Autograd refers to automatic differentiation, and XLA refers to accelerated linear algebra (compiler developed by Google that optimizes code to run fast on GPUs/TPUs). At a high level, … Continue reading

Posted in Blog | Leave a comment

Monte Carlo Methods

Problem: Distinguish between Las Vegas methods and Monte Carlo methods. Solution: Both are umbrella terms referring to broad classes of methods that draw (repeatedly) from (not necessarily i.i.d.) random variables to compute the value of some deterministic variable. Here, “compute” … Continue reading

Posted in Blog | Leave a comment

Differential Geometry

Problem: What does it mean for a topological space \(X\) to be locally homeomorphic to a topological space \(Y\)? Hence, what does it mean for a topological space \(X\) to be locally Euclidean? Solution: \(X\) is said to be locally … Continue reading

Posted in Blog | Leave a comment

Support Vector Machines

Problem: Explain how a hard-margin support vector machine would perform binary classification. Solution: Conceptually, it’s simple. Given a training set of \(N\) feature vectors \(\mathbf x_1,…,\mathbf x_N\in\mathbf R^n\) each associated with some binary target label \(y_1,…,y_N\in\{-1,1\}\) (notice the \(2\) binary … Continue reading

Posted in Blog | Leave a comment

Numerical Computation

Problem: In numerical computation, what are the \(2\) main kinds of rounding error? Solution: Overflow error (\(N\approx\infty\)) but perhaps even more dangerous is underflow error (\(\varepsilon\approx 0\)) which are in some sense inverses of each other: \[0=\frac{1}{\infty}\] Problem: Explain how … Continue reading

Posted in Blog | Leave a comment

Information Theory & Inference

Problem: Draw a schematic of a binary symmetric channel (BSC) with bit flip probability \(p_f\). Solution: Classically, one has: On the other hand, taking a more quantum perspective, in the computational basis \((|0\rangle,|1\rangle)\) one might define a binary symmetric channel … Continue reading

Posted in Blog | Leave a comment

SVD, Pseudoinverse, and PCA

Problem: State the form of the singular value decomposition (SVD) of an arbitrary linear operator \(X:\mathbf C^m\to\mathbf C^n\). Solution: The SVD of \(X\) is given by: \[X=U_2\Sigma U^{\dagger}_1\] where \(U_1\in U(m)\) and \(U_2\in U(n)\) are unitary operators and \(\Sigma:\mathbf C^m\to\mathbf … Continue reading

Posted in Blog | Leave a comment