Notes
128 study notes on machine learning, CUDA, C++, algorithms and English, written 2020–2023.
- CUDA Matrix Multiplication
Walkthrough of a tiled CUDA matrix multiplication kernel using shared memory, explaining how patches of A and B are indexed.
- Sentences
A memorable English sentence about success seeming inevitable in retrospect but elusive when sought, with its meaning.
- Decision Tree ID3
Python code for building an ID3 decision tree recursively and classifying samples with the resulting tree.
- IELTS Writing Templates
Template sentences and vocabulary for IELTS Writing Task 1 bar and pie charts and Task 2 essay structure, with a sample essay.
- Sharpening Function
Defines a sharpening function built from two sigmoid terms and shows its plot.
- Memoization for Backtracking
How to use a memo keyed by index and depth to avoid repeated searches in backtracking, with a LeetCode Combinations example.
- Sequence Models
Diagram notes on sequence models: RNN, GRU and LSTM.
- LLTM Gradients
Forward and backward pass of the LLTM PyTorch C++ extension, with notes on deriving the gradients via the chain rule.
- Docker
An index of notes on basic Docker operations, including Compose, Dockerfiles, networking, images and backups.
- GeneralizedRCNN Resize
Notes on NumPy/PyTorch broadcasting rules and how GeneralizedRCNN computes pairwise box overlaps with [:, None] indexing.
- Variable Changes in Recursive Backtracking
Traces how local variables change during recursive backtracking, using a Python function that parses a VOC XML annotation into a dict.
- Vocabulary
English vocabulary notes contrasting easily confused words such as fragile/fragrant, dusk/twilight, farther/further and delicate/dedicate, with example sentences.
- Uses of "as"
A one-page summary of the different uses of "as" in English.
- Positive Lookahead
Explains regex lookahead and lookbehind assertions using a password rule requiring upper-case, lower-case and special characters.
- Computer Networks
Brief computer network notes on routing, packet transmission time and the OSI reference model, mostly as figures.
- The Subjunctive Mood
A summary of English subjunctive forms for present, past and future conditions, plus special cases after suggest, wish, it is time and would rather.
- Left Multiplication Transforms Rows, Right Multiplication Transforms Columns
Explains why left-multiplying a matrix performs row transformations and right-multiplying performs column transformations, with figures.
- Deriving Coordinate Rotation and Translation
Deriving the 2D rigid-body rotation formulas with basic trigonometry, expressing a point in a rotated coordinate frame.
- CMake Basics
Notes on CMake: why it exists, make install, CTest tests, configure_file, and embedding the Git hash and build time into a header.
- AI Robotics
Figure-based notes on rotation matrices and reference frames in robotics.
- Vocabulary
A few English vocabulary notes: right after, right along and long-lasting effects.
- The Kalman Filter Explained
Notes on the Kalman filter as sensor fusion: data fusion, covariance matrices, state space representation and the formula derivation.
- Kalman Filter
Introduces the Kalman filter as sensor fusion of measurements and model predictions, with embedded PDF notes.
- For vs. Of
Explains when to use the prepositions for and of, covering recipient, purpose, reason and time, with example sentences.
- Remote
An unfinished draft of an email to a professor about a season change.
- Kubernetes
Basic minikube and kubectl commands for starting, inspecting, stopping and deleting a local Kubernetes cluster.
- Restrictive and Non-Restrictive Relative Clauses
The six differences between restrictive and non-restrictive relative clauses in English: form, function, translation, meaning, antecedent and relative words.
- Clauses Introduced by "as"
Notes on clauses introduced by "as" and how they differ from similar conjunctions.
- Dockerfile
A short annotated Dockerfile example based on node:11 and how to build an image with docker build.
- Dockerfile
How to back up and restore a Docker volume, using a MongoDB container and a temporary Ubuntu container.
- Pushing a Docker Image
Steps for logging in, tagging, pushing and running your own Docker image built from a Dockerfile.
- Docker Network
Overview of docker network commands, the default bridge/host/none networks, and connecting containers via a custom network with aliases.
- Docker Compose
Docker Compose examples for WordPress with MySQL, specifying the platform, and building a service from a Dockerfile.
- Docker Basic Operations
A short index page linking to Docker Compose notes.
- std::list Must Use Its Own sort
Why std::list needs its own sort member function, and how a function template calls an overloaded comparison operator.
- Multiset
A screenshot note about the C++ multiset container.
- Divide and Conquer
Divide and conquer illustrated with a recursive minimum-distance problem for two arrays and the Tower of Hanoi.
- Byte Alignment
The rules of C/C++ struct byte alignment and padding, illustrated by how member order changes sizeof(student) from 16 to 12.
- Subject Clauses
English grammar notes on subject clauses: introductory words, the formal subject it, and when that can be omitted.
- Object Complements
A short note explaining object complements, where a verb is followed by a noun and another noun that describes it.
- Omitting Relative Pronouns in Attributive Clauses
Explains when that, which, who and whom can be omitted in relative clauses, and how relative clauses differ from noun clauses.
- Object Clauses
Explains when "that" can be dropped from English object clauses and lists the cases where it must be kept.
- Analysing Long, Complex Sentences
Study notes dissecting long English sentences: reduced clauses, cleft sentences, non-finite modifiers, object complements, plus vocabulary glosses.
- Linear Interpolation
A visual derivation of linear and bilinear interpolation.
- Adverbial Clauses
Rules for omitting the subject and verb in English adverbial clauses, with example sentences.
- Recursive Backtracking
Using a recursion tree to trace multi-level recursive backtracking, with an annotated C++ example and common problem types.
- Note
A short research note on pixel similarity across channels and an idea for building segmentation combined with graph generation.
- ShiftCNN
Reading notes and open questions on ShiftCNN, which shifts channels in fixed directions between two point-wise convolutions.
- Makefile
A minimal Makefile example showing targets, dependencies and the order in which commands run.
- C++
Explains the argc and argv parameters of the C++ main function with a short example program.
- Warp Functions
Notes on CUDA warp shuffle functions for broadcasting and exchanging values between threads within a warp, including lane indexing and XOR swaps.
- STL
Overview of the six major STL components, with notes that stack and queue lack iterators and multiset uses red-black trees.
- Replacing Modulo with Bitwise AND
Shows how a % b can be replaced by the faster a & (b-1) when b is a power of two, with an example.
- Sparse
Short notes with figures on pruning neural networks, zeroing weights below a threshold in MLPs and pruning CNNs.
- Using vector in CUDA Kernels
Shows how to copy 1D and 2D std::vector data into device arrays for CUDA kernels, including cudaMallocPitch.
- 2D Vectors in C++
Two ways to initialise a two-dimensional std::vector in C++: the fill constructor and resize followed by a loop.
- Global Scope in the STL
Explains what prefixing :: to a C++ function or namespace means, using ::find() from the STL as an example.
- Red-Black Trees
The five properties of red-black trees and the insertion cases with recolouring and rotations, plus a summary.
- cudaMallocPitch and cudaMemcpy2D
An example of using cudaMallocPitch and cudaMemcpy2D to allocate and copy two-dimensional matrices on the GPU.
- Sign-Magnitude, One's and Two's Complement
Notes on how integers are represented in sign-magnitude, one's complement and two's complement.
- Counting FLOPs
How to count the floating-point operations of common neural-network layers.
- Hypothesis Testing with the t-Test
Notes on hypothesis testing using the t-distribution.
- Probability
The 68-95-99 rule: the share of a normal distribution within one, two and three standard deviations of the mean.
- Overloading new()
How to overload operator new() with extra parameters in C++, plus matching operator delete() versions.
- Other vs. Others
English grammar notes on the difference between other, others, the other and the others, plus common idiomatic patterns.
- p33 const
A reference figure summarising the rules of const in C++.
- Variadic Templates, auto and Range-Based for in C++
C++ notes on variadic template parameters, auto, range-based for loops, and what counts as a function signature.
- Friends in Class Templates
Covers the three kinds of friend declarations in C++ class templates and three ways to define template friend functions.
- Template Template Parameters
How C++ template template parameters let a Stack take a container template directly, and why default allocator parameters must be declared.
- Paper Reviews
A record of reviewer and editor comments on my MUMLP and CUGCN hyperspectral image classification papers.
- Template Specialization
Explains full and partial template specialization in C++, and why function templates use overloading instead of partial specialization.
- P22: Member Templates
Notes on C++ member templates in constructors, illustrated with a shared_ptr up-cast example.
- Overloading cout as a Global Function
Why C++ stream operators are overloaded as friend functions: a member operator<< would require writing obj << cout.
- Conv-MPN
Brief notes on the Conv-MPN paper for structured outdoor architecture reconstruction, starting with corner detection.
- Namespaces
A short illustration of how C++ namespaces resolve class name conflicts between development teams.
- Function-like Classes
Notes on when C++ creates temporary objects and why function-like classes (functors) are useful.
- Who vs. Whom
English grammar notes explaining when to use who and when to use whom, with example sentences.
- Transitions
Notes on advanced transition words in English writing, such as thereby, therein, thereof, wherein, whereby and hereby, plus semicolon usage.
- Overfitting and Underfitting
A summary of overfitting and underfitting and how to recognise them.
- Bias–Variance Decomposition of MSE
Derivation of the decomposition of mean squared error into bias, variance and noise.
- Expectation and Variance
Definitions and key properties of expectation and variance.
- C++ Notes: Static Members
Why C++ static member variables must be defined and initialised outside the class, and why static functions only access static data.
- For Loops and Recursion
A brief note on when recursion should be wrapped in a for loop, namely when subtasks split into multiple levels, as in permutations.
- Gradient of the Cross-Entropy Loss
Derivation of the gradient of softmax cross-entropy loss.
- Three Approaches to Reinforcement Learning
Slides comparing dynamic programming, Monte Carlo and temporal-difference methods in reinforcement learning.
- Monte Carlo Methods in Reinforcement Learning
Notes on Monte Carlo prediction and control in reinforcement learning.
- Dynamic Programming in Reinforcement Learning
Notes on policy evaluation, policy iteration and value iteration.
- Monte Carlo
Brief note on deriving the Monte Carlo estimator via a probability density function, sampling and averaging.
- Shallow and Deep Copy in C++
Explains shallow versus deep copying of classes with pointer members in C++, with a copy-constructor example.
- Why the Assignment Operator Returns a Reference
Explains shallow copy, overloading operator= in C++, and why it returns a reference to support chained assignment.
- Processes and Threads
Explains the differences between processes and threads using a train-and-carriages analogy, including mutexes and semaphores.
- In-Class Declaration and Definition
Explains defining C++ member functions inside versus outside the class, implicit inlining, and when inlining is not worthwhile.
- Subjunctive
Explains the subjunctive would have done using a news sentence about a pipeline decision, with example sentences.
- Avoiding shared_ptr Circular References
Tip for breaking shared_ptr reference cycles: own objects with strong pointers and reference them with weak pointers.
- Smart Pointers in C++
An overview of unique_ptr, shared_ptr and weak_ptr in C++.
- Maximum Likelihood and Gaussian Error
A short note on why maximising the Gaussian likelihood of errors leads to the maximum likelihood objective.
- VC Dimension
A short note on VC dimension: if four points cannot always be separated by a line, the VC dimension is not 4.
- Equilibria
A worked example of finding a pure-strategy Nash equilibrium by fixing each player and marking best responses.
- Homogeneous Coordinates
Why homogeneous coordinates are used to represent 3D transformations.
- C++
C++ notes on static methods, why temporaries cannot bind to non-const references, which temporaries are const, and const pointer syntax.
- DBSCAN Clustering
Notes on the density-based clustering algorithm DBSCAN.
- The Apriori Algorithm
Notes on the Apriori algorithm for frequent itemset mining and association rules.
- Word2Vec
Notes on the skip-gram and CBOW models of word2vec.
- Transition-Based Dependency Parsing
Notes on transition-based dependency parsing.
- TF-IDF
Notes on term frequency–inverse document frequency weighting.
- N-gram Language Models
Notes on n-gram language models and smoothing.
- The Transformer
A diagram-based overview of the Transformer architecture.
- Self-Attention
Diagrams illustrating the self-attention mechanism.
- Past Tense
Spelling rules for forming the English regular past tense: adding -ed or -d, changing y to i, and doubling final consonants.
- The Emotion Behind Your Money Habits
A quote from a TED talk about the emotional story behind the numbers in our money habits.
- English Sentences
An example English sentence illustrating the word commence and why graduations are called Commencement Exercises.
- Likelihood
Notes on likelihood functions and maximum likelihood estimation.
- "To Do" vs. "Doing"
When a verb is followed by an infinitive versus a gerund.
- The Silhouette Coefficient
Notes on the silhouette coefficient for evaluating clustering quality.
- Hierarchical Clustering
Explains hierarchical clustering and compares single, complete and average linkage for measuring distances between clusters.
- Theory
Embedded PDF notes on the basics of probability theory.
- BPR: Bayesian Personalized Ranking
Notes on the Bayesian Personalized Ranking algorithm for recommendation.
- English Pronunciation Notes
A PDF of notes on English pronunciation.
- 3D
Notes on camera calibration: why it is needed, lens distortion, and the world, camera, image and pixel coordinate systems.
- 3D Plotting in Python
A placeholder post on plotting 3D graphics with Python.
- MATI Regression
Embedded PDF slides on regression for the MATI course, including L1 and L2 regularization.
- Oral Practices
A single English sentence saved for speaking practice.
- English Sentences
Assorted English phrases and grammar notes, covering who vs. whom, "had better", the passive voice, "used to", and "how come".
- Scrapy
A Scrapy XPath tip for extracting text that follows nested span elements by indexing the last text node.
- Short-Term Prediction of Stock Market Prices Based on GA-Optimized LSTM Neurons
Summary of a 2018 paper using a genetic algorithm to optimise LSTM neuron weights for faster short-term stock price prediction.
- Object Detection Algorithm Based on Fast R-CNN with AdaBoost Residual Correction
Conference paper on cattle face detection using Fast R-CNN with an AdaBoost residual detector, raising accuracy to about 97%.
- CAGU: Context-Aware Attentional Graph U-Net for Hyperspectral Image Classification
Overview of CAGU, a graph U-Net with GRU-based context modelling for hyperspectral image classification, published in IEEE GRSL.
- Cross-Entropy Loss Explained
Explains the math behind cross-entropy loss and verifies PyTorch's CrossEntropyLoss step by step via softmax, log and NLLLoss for pixel-wise classification.
No notes match.