Skip to content

Commit cbc761b

Browse files
authored
fix(lessons): source errors in phases 00 to 06 from #585 (#691)
* fix(lessons): phase-00/03 add the PyTorch install command The Install PyTorch step showed only the check script. Refs #585 * fix(lessons): phase-00/10 count four redirects and the pipe The table lists four redirect operators and a pipe, not three redirects. Refs #585 * fix(lessons): phase-00/11 count the 13 essential commands The Essential Commands section lists 13 commands, not 15. Refs #585 * fix(lessons): phase-01/01 scope unique least squares to full column rank Full rank with fewer rows than columns still gives infinitely many solutions. Refs #585 * fix(lessons): phase-01/06 state the CLT conditions The CLT needs independent draws from one distribution with finite variance. Refs #585 * fix(lessons): phase-01/08 descend against the gradient, scope convexity The gradient points uphill, and convex functions can have many minimizers. Refs #585 * fix(lessons): phase-01/09 scope the MI versus correlation claim MI detects any dependence in principle, but finite-sample estimates need care. Refs #585 * fix(lessons): phase-01/13 fix the float32 overflow comparison 2.69e43 is larger than the float32 maximum 3.4e38. Refs #585 * fix(lessons): phase-01/14 define the unit ball as distance at most 1 Distance exactly 1 is the unit sphere, the ball's boundary. Refs #585 * fix(lessons): phase-01/16 give rejection rate for unnormalized targets The acceptance rate is Z/M and equals 1/M only for a normalized target. Refs #585 * fix(lessons): phase-01/18 scope the convex optimization guarantee Convexity rules out bad local minima; it does not force a unique valley or any step size. Refs #585 * fix(lessons): phase-01/20 scope DFT magnitude and FFT length claims Unnormalized magnitude is AN/2, and only radix-2 FFTs need power-of-2 lengths. Refs #585 * fix(lessons): phase-01/21 use weighted degree in the Laplacian The doc now matches graph_theory.py, which sums edge weights. Refs #585 * fix(lessons): phase-01/22 state the spectral gap for reversible chains The 1 minus second eigenvalue rule applies to reversible chains, by magnitude. Refs #585 * fix(lessons): phase-02/03 scope the convex BCE minimum claim Convexity does not give a unique or finite minimum on separable data. Refs #585 * fix(lessons): phase-02/04 separate pure leaves from single-sample leaves A pure leaf can hold many samples of one class. Refs #585 * fix(lessons): phase-02/05 give LinearSVC cost as O(n*d) per epoch The primal cost is linear in n and in d, as the lesson states earlier. Refs #585 * fix(lessons): phase-02/08 state what mean imputation does to the shape Mean and median imputation shrink variance and add a spike. Refs #585 * fix(lessons): phase-02/15 replace differencing never hurts Over-differencing adds noise and drops level information. Refs #585 * fix(lessons): phase-02/16 make the IsolationForest snippet runnable The snippet had placeholder text and undefined rng and trees. Refs #585 * fix(lessons): phase-02/17 define the split for threshold tuning The snippet used X_val and y_val without creating them. Refs #585 * fix(lessons): phase-02/18 match learning objectives to the built methods The code builds variance, MI, RFE, L1 and tree importance. Refs #585 * fix(lessons): phase-03/13 capitalize the sentence start A sentence started with a lowercase word. Refs #585 * fix(lessons): phase-04/04 fix the label smoothing target The positive class keeps eps/C, so the target sums to 1. Refs #585 * fix(lessons): phase-04/06 make encode invert decode, count four weights encode now stores a logit, as code/main.py does; the loss has four weights. Refs #585 * fix(lessons): phase-04/07 scope the divisible-by-16 input rule The up block resizes, so other sizes work after interpolation. Refs #585 * fix(lessons): phase-04/08 count five Mask R-CNN losses The formula and the torchvision loss dict have five terms. Refs #585 * fix(lessons): phase-04/10 end the DDIM schedule at the clean sample The schedule stopped at t=0 and never used the alpha 1.0 endpoint. Refs #585 * fix(lessons): phase-04/11 drop compel from the int8 options compel weights prompts; it does not quantize. Refs #585 * fix(lessons): phase-04/12 correct the 3D conv FLOPs estimate Inflating 3x3 to 3x3x3 costs about 3x, not T/8. Refs #585 * fix(lessons): phase-04/15 fix the accuracy typo and the p50 wording The hook lacked a percent sign and the latency line was unclear. Refs #585 * fix(lessons): phase-04/16 fix the article and the mask field name The contract now uses mask_rle like the code. Refs #585 * fix(lessons): phase-04/19 give OCR glyphs an identity, fix DocLayNet All characters drew the same box, so the model could not learn them. Refs #585 * fix(lessons): phase-04/21 clarify the sub-pixel offset sentence The sentence ended with a stray word and did not read. Refs #585 * fix(lessons): phase-04/26 name the principal point assumption The text said moderate-resolution principals. Refs #585 * fix(lessons): phase-04/27 list SAM 2 prompt types SAM 2 takes clicks, boxes and masks; text prompts came with SAM 3. Refs #585 * fix(lessons): phase-05/02 sparse vectors are mostly zero Sparse means most entries are zero, not small. Refs #585 * fix(lessons): phase-05/04 state BPE vocab size for both start points k + 256 holds only for a byte-level start. Refs #585 * fix(lessons): phase-05/05 name the sklearn bigram feature scikit-learn joins bigram words with a space. Refs #585 * fix(lessons): phase-05/15 describe c_v coherence precisely c_v uses NPMI context vectors and cosine similarity. Refs #585 * fix(lessons): phase-05/24 remove the ambiguous pronoun in the example They could refer to the products, so the example now says it and them. Refs #585 * fix(lessons): phase-05/26 load REBEL as a seq2seq model REBEL is BART-based and generates triples; it is not a classifier. Refs #585 * fix(lessons): phase-06/05 separate Whisper language and task tags The language tag names the audio language; the task tag picks transcribe or translate. Refs #585 * fix(lessons): phase-06/17 use WER for round trip, credit the Suno ELO The ELO 1293 came from Suno's own benchmark, not TTS Arena. Refs #585 * fix(lessons): phase-01/06 state the CLT for the centered, scaled mean Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-01/08 qualify the gradient descent convergence claim Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-01/18 qualify the gradient descent convergence claim Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-01/20 describe the dft fallback for odd lengths Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-02/04 stop splitting when no split separates samples Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-02/15 scope the linear-model trend claim Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-02/16 define _c_factor and guard a zero factor Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-04/06 store logit offsets in assign_targets Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-04/10 scope the eta=1 DDPM claim Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-04/15 say 90%-accurate model Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-05/02 scope the sparsity claim to real vocabularies Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-05/26 note that REBEL output needs parsing Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-06/05 drop verbatim from the transcribe task Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-06/17 match the evaluator skill to WER and CER Addresses review on the #585 fixes. Refs #585 * fix(lessons): phase-06/17 give the Spanish round-trip metric The example release covers English and Spanish, not Mandarin. Refs #585 * fix(lessons): second round of review fixes for #585 Scope the remaining convexity guarantees in 01/18, label the harmonic number approximation in 02/16, and name real normalizers for the Spanish round-trip WER in the 06/17 evaluator skill. Refs #585
1 parent 7e8c846 commit cbc761b

47 files changed

Lines changed: 140 additions & 86 deletions

File tree

  • phases
    • 00-setup-and-tooling
      • 03-gpu-setup-and-cloud/docs
      • 10-terminal-and-shell/docs
      • 11-linux-for-ai/docs
    • 01-math-foundations
      • 01-linear-algebra-intuition/docs
      • 06-probability-and-distributions/docs
      • 08-optimization/docs
      • 09-information-theory/docs
      • 13-numerical-stability/docs
      • 14-norms-and-distances/docs
      • 16-sampling-methods/docs
      • 18-convex-optimization/docs
      • 20-fourier-transform/docs
      • 21-graph-theory/docs
      • 22-stochastic-processes/docs
    • 02-ml-fundamentals
      • 03-logistic-regression/docs
      • 04-decision-trees/docs
      • 05-support-vector-machines/docs
      • 08-feature-engineering/docs
      • 15-time-series/docs
      • 16-anomaly-detection/docs
      • 17-imbalanced-data/docs
      • 18-feature-selection/docs
    • 03-deep-learning-core/13-debugging-neural-networks/docs
    • 04-computer-vision
      • 04-image-classification/docs
      • 06-object-detection-yolo/docs
      • 07-semantic-segmentation-unet/docs
      • 08-instance-segmentation-mask-rcnn/docs
      • 10-image-generation-diffusion
      • 11-stable-diffusion/docs
      • 12-video-understanding/docs
      • 15-real-time-edge/docs
      • 16-vision-pipeline-capstone/docs
      • 19-ocr-document-understanding
      • 21-keypoint-pose/docs
      • 26-monocular-depth/docs
      • 27-multi-object-tracking/docs
    • 05-nlp-foundations-to-advanced
      • 02-bag-of-words-tfidf/docs
      • 04-glove-fasttext-subword/docs
      • 05-sentiment-analysis/docs
      • 15-topic-modeling/docs
      • 24-coreference-resolution/docs
      • 26-relation-extraction-kg/docs
    • 06-speech-and-audio

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎phases/00-setup-and-tooling/03-gpu-setup-and-cloud/docs/en.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ Check if you have one:
5555
nvidia-smi
5656
```
5757

58-
Install PyTorch with CUDA:
58+
Install PyTorch with CUDA. On Linux the default wheel ships with CUDA. On Windows, copy the CUDA command from the selector at pytorch.org.
59+
60+
```bash
61+
pip install torch torchvision torchaudio
62+
```
63+
64+
Then check that PyTorch sees the GPU:
5965

6066
```python
6167
import torch

‎phases/00-setup-and-tooling/10-terminal-and-shell/docs/en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ python train.py > output.log 2> errors.log
9797
python train.py > train_full.log 2>&1
9898
```
9999

100-
The three redirects you need:
100+
The four redirects and the pipe you need:
101101

102102
| Symbol | What it does |
103103
|--------|-------------|

‎phases/00-setup-and-tooling/11-linux-for-ai/docs/en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Your home directory is `~` or `/home/your-username`. Almost everything you do ha
3939

4040
## Essential Commands
4141

42-
These are the 15 commands that cover 95% of what you'll do on a remote GPU box.
42+
These are the 13 commands that cover most of what you'll do on a remote GPU box.
4343

4444
### Moving Around
4545

‎phases/01-math-foundations/01-linear-algebra-intuition/docs/en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Rank of a matrix = number of linearly independent columns = number of linearly i
113113

114114
| Situation | Rank | What it means for ML |
115115
|-----------|------|---------------------|
116-
| Full rank $(\text{rank} = \min(m, n))$ | Maximum possible | Unique least-squares solution exists. Model is well-conditioned. |
116+
| Full rank $(\text{rank} = \min(m, n))$ | Maximum possible | With at least as many rows as columns (full column rank), the least-squares solution is unique. With fewer rows than columns, infinitely many solutions fit exactly. |
117117
| Rank deficient $(\text{rank} < \min(m, n))$ | Below maximum | Features are redundant. Infinitely many weight solutions. Regularization needed. |
118118
| Rank 1 | 1 | Every column is a scaled copy of one vector. All data lies on a line. |
119119
| Near rank-deficient (small singular values) | Numerically low | Matrix is ill-conditioned. Tiny input noise causes large output changes. Use SVD truncation or ridge regression. |

‎phases/01-math-foundations/06-probability-and-distributions/docs/en.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,14 @@ The row and column totals in the table above are the marginals.
190190

191191
### Why the Normal Distribution Shows Up Everywhere
192192

193-
The Central Limit Theorem: the sum (or average) of many independent random variables converges to a normal distribution, regardless of the original distribution.
193+
The Central Limit Theorem: the average of many independent random variables from the same distribution, once centered and scaled by $\sqrt{n}$, approaches a normal distribution, whatever the shape of the original distribution, as long as its variance is finite. The same holds for the centered and scaled sum.
194194

195195
```
196196
Roll 1 die: uniform distribution (flat)
197197
Average of 2 dice: triangular (peaked)
198198
Average of 30 dice: nearly perfect bell curve
199199
200-
This works for ANY starting distribution.
200+
This works for ANY starting distribution with finite variance.
201201
```
202202

203203
This is why:
@@ -470,7 +470,7 @@ You built these from scratch. Now you know what the library calls are doing.
470470
| Expected value | "The average" | The probability-weighted sum of all outcomes. The loss function is an expected value |
471471
| Variance | "How spread out" | The expected squared deviation from the mean. High variance = noisy, unstable estimates |
472472
| Normal distribution | "The bell curve" | $f(x) = (1/\sqrt{2\pi\sigma^2}) \cdot \exp(-(x-\mu)^2/(2\sigma^2))$. Appears everywhere due to the CLT |
473-
| Central Limit Theorem | "Averages become normal" | The mean of many independent samples converges to a normal distribution regardless of the source |
473+
| Central Limit Theorem | "Averages become normal" | The centered, scaled mean of many independent samples converges to a normal distribution for any source with finite variance |
474474
| Joint distribution | "Two variables together" | $P(X, Y)$ describes the probability of every combination of $X$ and $Y$ outcomes |
475475
| Marginal distribution | "Sum out the other variable" | $P(X) = \sum_y P(X, Y)$. Recovers one variable's distribution from the joint |
476476
| Log probability | "Log of the probability" | $\log P(x)$. Turns products into sums, preventing numerical underflow in long sequences |

‎phases/01-math-foundations/08-optimization/docs/en.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ That is the entire algorithm. One line.
4646

4747
```mermaid
4848
graph TD
49-
A["* Starting point (high loss)"] --> B["Moving downhill along gradient"]
49+
A["* Starting point (high loss)"] --> B["Moving downhill, against the gradient"]
5050
B --> C["Approaching minimum"]
5151
C --> D["o Minimum (low loss)"]
5252
```
@@ -158,7 +158,7 @@ Common schedules:
158158

159159
### Convex vs non-convex
160160

161-
A convex function has one minimum. Gradient descent always finds it. A quadratic like $f(x) = x^2$ is convex.
161+
A convex function has no bad local minima: every local minimum is a global minimum. For a smooth convex function that has a minimum, gradient descent with a small enough learning rate converges to it. A quadratic like $f(x) = x^2$ is convex, and its minimum is unique.
162162

163163
Neural network loss functions are non-convex. They have many local minima, saddle points, and flat regions.
164164

‎phases/01-math-foundations/09-information-theory/docs/en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Properties:
202202
2. Rank features by MI score.
203203
3. Keep the top $k$ features.
204204

205-
This works for any relationship between feature and target -- linear, nonlinear, monotonic, or not. Correlation only catches linear relationships. MI catches everything.
205+
This works for any relationship between feature and target -- linear, nonlinear, monotonic, or not. Pearson correlation only catches linear relationships. MI catches any dependence, but with finite data its estimate needs enough samples and a sensible binning.
206206

207207
| Method | Detects | Computational cost | Handles categorical? |
208208
|--------|---------|-------------------|---------------------|

‎phases/01-math-foundations/13-numerical-stability/docs/en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ exp(101) = 7.31e43
184184
exp(102) = 1.99e44
185185
sum = 2.99e44
186186
187-
These overflow float32 (max ~3.4e38)? No, 2.69e43 < 3.4e38? Actually:
187+
2.69e43 > 3.4e38, the float32 maximum, so every term overflows.
188188
exp(88.7) is already at the float32 limit.
189189
exp(100) = inf in float32.
190190
```

‎phases/01-math-foundations/14-norms-and-distances/docs/en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ L1 and L2 are special cases of the Lp norm:
102102
\lVert x \rVert_p = (|x_1|^p + |x_2|^p + \cdots + |x_n|^p)^{1/p}
103103
```
104104

105-
Different values of $p$ produce different shaped "unit balls" (the set of all points at distance 1 from the origin):
105+
Different values of $p$ produce different shaped "unit balls" (the set of all points at distance at most 1 from the origin; the shapes below are their boundaries):
106106

107107
```
108108
p=1: Diamond shape (corners on axes)

‎phases/01-math-foundations/16-sampling-methods/docs/en.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ Algorithm:
117117
3. If u < p(x) / (M * q(x)), accept x
118118
4. Otherwise, reject and go to step 1
119119
120-
Acceptance rate = 1/M
120+
Acceptance rate = Z/M, where Z is the integral of p(x)
121+
(Z = 1, so the rate is 1/M, when p is normalized)
121122
```
122123

123124
The tighter the bound $M$, the higher the acceptance rate. In low dimensions (1-3), rejection sampling works well. In high dimensions, the acceptance rate drops exponentially because most of the proposal volume gets rejected. This is the curse of dimensionality for rejection sampling.

0 commit comments

Comments
 (0)