8428 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
3be298f3d2 Merge branch 'dev' into feature/alt-text-generation 2025-11-10 19:56:52 -05:00
Vijay Janapa Reddi
0b3f04d82d Removes backup file
Deletes the backup file that contains a list of scripts.
This action streamlines the repository and avoids potential
confusion or conflicts arising from outdated file lists.
2025-11-10 19:56:29 -05:00
Vijay Janapa Reddi
1b27fd70c1 Removes deprecated cross-ref injection filters
Deletes the backup and experimental cross-reference injection filters.

These filters are no longer needed as the primary injection mechanism
has been stabilized and improved. Removing them cleans up the codebase
and avoids confusion.
2025-11-10 19:56:19 -05:00
Vijay Janapa Reddi
8ba525a085 Removes broken Chocolatey Dockerfile
Removes the Dockerfile that used Chocolatey as the primary means to install packages on Windows. This Dockerfile was failing due to inconsistencies in Chocolatey package availability and reliability.
2025-11-10 19:56:07 -05:00
Vijay Janapa Reddi
b0f5d081d5 Removes outdated Windows Dockerfile
Removes the `docker/windows/Dockerfile.backup-2025-10-08` file.
This Dockerfile is no longer needed, as it represents a backup of a previous configuration and is superseded by more recent and actively maintained Dockerfiles.
2025-11-10 19:56:00 -05:00
Vijay Janapa Reddi
d643c08019 Improves LaTeX command robustness.
Protects LaTeX commands by using `\protect` to ensure proper expansion and prevent errors, especially when used in environments where arguments might be prematurely evaluated.

Specifically, it ensures correct handling of potentially fragile arguments in `\fbxIncludeIcon` and the `title` argument of the `tcolorbox` environment. Additionally, it corrects the command which was incorrectly replacing all hyphens instead of just the first one.
2025-11-10 19:55:45 -05:00
Vijay Janapa Reddi
2e6a7b6139 fix(pdf): replace ALL hyphens in callout icon names
Fixed StrSubstitute to use asterisk (*) to replace all hyphens, not just
the first one, when converting callout class names to icon filenames.

Problem:
- Without asterisk: callout-quiz-question → icon_callout_quiz-question 
- Icon file doesn't exist, PDF build fails or shows missing icons

Solution:
- With asterisk: callout-quiz-question → icon_callout_quiz_question 
- Correctly matches existing icon files

Fixes icon loading for 6 callout types with multiple hyphens:
- callout-quiz-question (auto-generated by inject_quizzes.lua)
- callout-quiz-answer (auto-generated by inject_quizzes.lua)
- callout-chapter-connection (margin-connections.lua)
- callout-resource-exercises
- callout-resource-slides
- callout-resource-videos

All icon files verified to match naming convention.
2025-11-10 14:01:57 -05:00
Vijay Janapa Reddi
1bb5aac313 refactor(lint): use Python built-in json module for validation
Replaced external check-json hook with custom validator using Python's
built-in json module (json.load). Created validate_json.py wrapper to
handle multiple files.

Benefits:
- No external dependencies
- Uses Python's standard library json parser
- Same validation logic as the build system
- Fast and reliable (0.16s for all JSON files)
2025-11-10 13:23:15 -05:00
Vijay Janapa Reddi
fd96039400 feat(lint): add JSON validation to pre-commit hooks
Added check-json hook to automatically validate all JSON files on commit.
Fixed JSON syntax errors in:
- sustainable_ai_quizzes.json (11 missing commas)
- cross_refs_no_explanation.json (trailing commas)
- cross_refs.json (incomplete file, reset to empty array)

All JSON files now pass validation.
2025-11-10 12:35:28 -05:00
Vijay Janapa Reddi
f73e41148c Merge refactor/consolidate-callout-styles into dev
Consolidate and standardize callout/foldbox styling architecture:

MAJOR CHANGES:
- Consolidated callout dark mode styles (Extension-First architecture)
- Standardized icon filenames to snake_case only
- Fixed manual dark mode toggle support
- Enhanced left-alignment for all callout content
- Improved example icon size for consistency

COMMITS MERGED (7):
1. refactor(styles): Consolidate callout styling into foldbox.css
2. docs: Document completed consolidation
3. fix(styles): Restore callout dark mode for manual toggle
4. fix(styles): Comprehensive left-alignment for all callouts
5. fix(icons): Increase example icon size to match quiz icons
6. fix(icons): Add hyphenated filenames for PDF (superseded)
7. refactor(icons): Standardize to snake_case filenames only

BENEFITS:
 ~190 lines duplicate CSS eliminated
 Single source of truth for callout styling
 Consistent icon naming (snake_case)
 Dark mode works for both system and manual toggle
 All formats tested (HTML, PDF, EPUB)

TESTING:
 All builds successful (HTML/PDF/EPUB)
 Icons render correctly across formats
 Dark mode styling verified
 Left-alignment consistent
2025-11-10 07:47:26 -05:00
kai
ab0926a47a socratiQ folder in root. socratiQ folder in tools dedicated to the build. 2025-11-10 07:08:07 -05:00
Vijay Janapa Reddi
8aac863de9 refactor(icons): Standardize to snake_case filenames only
PROBLEM: Mixed naming conventions (hyphenated and underscored) for icon
files causing confusion and maintenance burden.

SOLUTION: Standardize on snake_case (underscored) filenames ONLY and
update TeX macros to convert hyphens to underscores automatically.

CHANGES:
1. Updated foldbox.tex:
   - Added xstring package for string manipulation
   - Created \fbxIncludeIcon macro that converts hyphens to underscores
   - Updated both fbx and fbxSimple environments to use new macro
   - Example: callout-quiz-question -> icon_callout_quiz_question.pdf

2. Removed ALL hyphenated icon files (22 files deleted):
   - icon_callout-quiz-question.*
   - icon_callout-quiz-answer.*
   - icon_callout-definition.*
   - icon_callout-example.*
   - icon_callout-colab.*
   - icon_callout-chapter-connection.*
   - icon_callout-resource-*.*
   - icon_callout-code.*

3. Kept ONLY underscored icon files:
   - icon_callout_quiz_question.*
   - icon_callout_quiz_answer.*
   - icon_callout_definition.*
   - icon_callout_example.*
   - icon_callout_colab.*
   - etc.

HOW IT WORKS:
- HTML: Lua filter converts hyphens to underscores (existing behavior)
- PDF: TeX macro converts hyphens to underscores (new behavior)
- EPUB: Uses PNG with underscored names (existing behavior)

BENEFITS:
 Single source of truth (underscored filenames only)
 No duplicate files
 Consistent naming across all formats
 Easier maintenance and less confusion
 Follows snake_case standard for file naming

TESTING:
 HTML build successful
 PDF build successful (with TeX conversion)
 No missing icon errors
2025-11-09 20:05:53 -05:00
Vijay Janapa Reddi
aa21938e45 fix(icons): Add hyphenated icon filenames for PDF compilation
PDF builds use hyphenated callout class names (callout-quiz-question)
while HTML uses underscored names (callout_quiz_question) for icon lookup.

ISSUE: PDF compilation failed with error:
"Package luatex.def Error: File 'icon_callout-quiz-question.pdf' not found"

SOLUTION: Created hyphenated versions of all icon files to support both
naming conventions used by different Quarto output formats.

FILES ADDED (both PNG and PDF):
- icon_callout-quiz-question (hyphenated)
- icon_callout-quiz-answer (hyphenated)
- icon_callout-definition (hyphenated)
- icon_callout-example (hyphenated)
- icon_callout-colab (hyphenated)

EXISTING FILES KEPT (underscored):
- icon_callout_quiz_question
- icon_callout_quiz_answer
- icon_callout_definition
- icon_callout_example
- icon_callout_colab

This dual naming ensures compatibility with:
- HTML builds (use underscores via Lua filter conversion)
- PDF builds (use hyphens directly from class names)
- EPUB builds (use PNG with either convention)

TESTING:
 PDF build successful (./binder pdf intro)
 HTML build successful (./binder html intro)
 No more missing icon errors
2025-11-09 19:59:59 -05:00
Vijay Janapa Reddi
fe1c8d481e fix(icons): Increase example icon size to match quiz icons
Regenerated example icon with larger, more prominent document and checkmark
to match the visual weight of quiz question/answer icons.

BEFORE:
- 678 bytes, 4-bit colormap
- Very small visual appearance

AFTER:
- 2.0K PNG (16-bit RGBA), 8.6K PDF
- Larger document shape (30,20 to 98,108)
- Bold checkmark with 8px stroke width
- Three horizontal lines on document for better definition

TESTING:
 HTML build successful
 Icon now comparable in size to quiz icons (12-13K)
 Better visibility and consistency across callout types
2025-11-09 19:58:09 -05:00
Vijay Janapa Reddi
1a3df0501f fix(styles): Ensure comprehensive left-alignment for all callout content
Added explicit left-alignment rules for all custom callout types to ensure
consistent text alignment across definition, example, quiz, colab callouts.

CHANGES:
- Extended content body styling to ALL callout types (not just fbx-default)
- Added explicit left-alignment for paragraphs (p), lists (ul/ol), and
  list items (li) inside all callouts
- Added left-alignment for summary strong elements (callout titles)
- Applied !important flags to override any Quarto defaults

CALLOUT TYPES COVERED:
- definition, example, quiz-question, quiz-answer, colab
- chapter-connection, chapter-forward, chapter-recall
- resource-slides, resource-videos, resource-exercises, code

TESTING:
 HTML build successful
 All callout content now consistently left-aligned

This ensures proper text flow and readability in both light and dark modes.
2025-11-09 19:56:04 -05:00
Vijay Janapa Reddi
c3df4f18e7 fix(styles): Restore callout dark mode styles for manual toggle
ISSUE: Dark mode callouts not styled when using manual toggle button

ROOT CAUSE: Quarto has TWO dark mode mechanisms:
1. System dark mode (@media prefers-color-scheme) - handled by foldbox.css
2. Manual toggle button - loads dark-mode.scss as separate stylesheet

When we removed callout styles from dark-mode.scss (commit 56c30395f),
we broke manual toggle dark mode. The @media query in foldbox.css only
works for system-level dark mode, NOT the manual toggle.

SOLUTION: Restore all callout dark mode styles to dark-mode.scss
WITHOUT @media query (file only loads when dark mode active via toggle)

STYLES RESTORED:
- Callout colors/backgrounds (quiz, definition, example, colab, etc.)
- Summary header text colors (#f0f0f0)
- Content body backgrounds (#212529)
- Arrow styling
- Code element colors
- Link colors with hover states

TESTING:
 HTML build successful
 Manual toggle dark mode now works
 System dark mode still works (via foldbox.css)
 No duplication issues (different trigger mechanisms)

This is necessary duplication: same styles, different activation methods.
2025-11-09 19:34:22 -05:00
Vijay Janapa Reddi
c004a20f8b docs: Document completed callout styling consolidation
Added comprehensive REFACTORING COMPLETED section documenting:
- Changes to dark-mode.scss (159 lines → 13 lines)
- Changes to style.scss (52 refs → 8 refs)
- Verification that foldbox.css already had all needed styles
- New Extension-First architecture diagram
- Testing results (HTML/EPUB builds, output verification)
- Metrics (~190 lines removed, 2 files modified)
- Benefits achieved (no duplication, single source of truth)
- Issues resolved (colab dark mode, maintenance burden)

Status: Ready for review and merge to dev
2025-11-09 17:21:05 -05:00
Vijay Janapa Reddi
56c30395f8 refactor(styles): Consolidate callout styling into foldbox.css extension
Implement Extension-First architecture for callout/foldbox styling:

CHANGES:
- foldbox.css: Now the single source of truth for ALL callout styling
  (light mode + dark mode via @media query)
- dark-mode.scss: Removed 159 lines of duplicate callout rules
  (colors, backgrounds, text, arrows, links) - all now in foldbox.css
- style.scss: Simplified to minimal Quarto overrides (52 references → 8)
  Removed redundant alignment/list rules now handled by extension

BENEFITS:
- Eliminates duplication between foldbox.css and dark-mode.scss
- Self-contained extension easier to maintain and debug
- Clear separation: extension handles styling, host SCSS only excludes
- Consistent dark mode behavior via prefers-color-scheme media query

TESTING:
 HTML build successful (intro chapter)
 EPUB build successful (intro chapter)
 Callout icons render correctly (definition, quiz, example)
 Dark mode styles present in built foldbox.css
 All callout types included (colab, definition, quiz, resources, etc.)

Addresses architecture issues identified in CALLOUT_STYLING_ANALYSIS.md
2025-11-09 17:19:37 -05:00
Vijay Janapa Reddi
26ddcd2dfc docs: Add comprehensive callout styling architecture analysis
Document current 4-file architecture (foldbox.css, style.scss, dark-mode.scss, epub.css)
identifying duplication and proposing Extension-First consolidation strategy.

Key findings:
- Dark mode styles duplicated between foldbox.css and dark-mode.scss
- callout-colab missing from dark-mode.scss
- style.scss has 52 references (most scattered)
- Recommends consolidating all styles into self-contained foldbox.css extension

No code changes yet - analysis and planning only.
2025-11-09 17:04:26 -05:00
Vijay Janapa Reddi
c20c73508b feat(accessibility): Add GenAI-powered alt-text generation tools
- Add generate_alt_text.py script for automated image alt-text generation
- Add README_ALT_TEXT.md with detailed usage instructions
- Add QUICK_START_ALT_TEXT.md for quick reference
- Uses Google Gemini API to generate descriptive alt-text for figures

Related to accessibility improvements for image descriptions.
Work in progress - requires GitHub issue tracking.
2025-11-09 16:53:44 -05:00
Vijay Janapa Reddi
57a455de62 chore: Remove test callout-colab from Introduction chapter
Test callout has been removed now that icon infrastructure is complete.
The callout-colab styling is ready to use throughout the book.
2025-11-09 16:48:04 -05:00
Vijay Janapa Reddi
c2d8fd873c fix(callout): Use title attribute for callout-colab matching definition pattern
- Change from markdown heading (##) to title attribute
- Ensures callout-colab renders with same title styling as definition callouts
- Title now appears in summary with proper left alignment and icon placement

This matches the exact pattern used for callout-definition, callout-example, etc.
2025-11-09 16:45:21 -05:00
Vijay Janapa Reddi
3a7bb1f813 fix(styling): Add callout-colab to all style.scss rules matching other callouts
- Add callout-colab to exclusion from general callout styling (removes box-shadow)
- Add callout-colab to all alignment rules (left-align content, lists, summaries)
- Add callout-colab to empty paragraph handling
- Ensures callout-colab follows exact same pattern as definition/example/quiz callouts

This makes callout-colab render identically to other custom callouts, just with
orange color and code icon.
2025-11-09 16:42:47 -05:00
Vijay Janapa Reddi
b4190f1b7c fix(styling): Add callout-colab styles to EPUB format
- Add callout-colab styles to epub.css matching definition/example pattern
- Ensure consistent EPUB rendering with orange color (#FF6B35)
- No changes to foldbox.css since definition/example were already working

The callout-colab now has the same structure as definition/example callouts
with only color and icon differences.
2025-11-09 16:40:19 -05:00
Vijay Janapa Reddi
06fe551f8c feat(icons): Upscale all callout icons to high resolution (128x128)
- Upscale definition, quiz, resource, and chapter connection icons from ~43px to 128px
- Replace colab icon with circle design (light circle, bold brackets)
- Use Lanczos filter for high-quality upscaling
- Regenerate all PDF versions from high-res PNGs
- Remove temporary backup and test files

All icons now consistently use 128x128 resolution for crisp, sharp rendering
across HTML, PDF, and EPUB formats.
2025-11-09 16:36:00 -05:00
Vijay Janapa Reddi
85844079d9 chore: Remove README_ICONS.md documentation file
Removed temporary documentation file as icon setup is complete.
2025-11-09 16:30:12 -05:00
Vijay Janapa Reddi
cadef82683 feat(icons): Complete callout styling with restored original icons
- Add callout-colab CSS styling (light and dark mode) to match definition/example
- Restore original icon_callout_definition.png/pdf from commit 267fc5518
- Create new icon_callout_example.png/pdf (teal document with checkmark)
- Remove outer box styling from callout-colab to match other callouts
- Add dark mode support for callout-colab with proper color scheme
- Add test callout-colab to Introduction chapter for preview

This completes the visual integration of callout-colab with existing callout types.
2025-11-09 16:29:57 -05:00
Vijay Janapa Reddi
069cf99fd4 feat(icons): Add callout-colab to format-specific configs
- Define colab-interactive group in HTML, PDF, and EPUB configs
- Add callout-colab class mapping in all three formats
- Ensure consistent orange color scheme (FFF5E6/FF6B35) across formats
- Use PDF icons for PDF builds, PNG icons for HTML/EPUB builds

This completes the callout-colab icon infrastructure enabling interactive
Colab notebooks to be referenced throughout the book with consistent styling.
2025-11-09 15:36:54 -05:00
Vijay Janapa Reddi
74a1e64131 feat(icons): Add callout-colab icon infrastructure
- Add icon_callout_colab.png/pdf for interactive Colab callouts (orange code symbol)
- Add icon_callout-code.png/pdf as base code icon (blue-gray)
- Update Lua filter to support snake_case icon filenames (callout-colab → callout_colab)
- Define callout-colab class in Quarto configs (HTML, PDF, EPUB)
- Remove duplicate hyphenated icon files (definition, example, quiz-question, quiz-answer)
- Add README_ICONS.md for icon documentation and maintenance

This infrastructure enables the integration of interactive Google Colab notebooks
throughout the book using a consistent, styled callout pattern.
2025-11-09 15:34:09 -05:00
Vijay Janapa Reddi
88f36b6546 Removes extraneous blank lines.
Removes unnecessary blank lines at the end of the file to improve code cleanliness and consistency.
2025-11-09 12:10:02 -05:00
Vijay Janapa Reddi
663b530766 Corrects weight matrix and forward propagation
Fixes inconsistencies in the representation of weight matrices
and the order of operations in forward propagation. This ensures
accurate calculations and a clearer understanding of neural
network computations.
2025-11-09 12:09:41 -05:00
Vijay Janapa Reddi
f00cc5e9c9 Refactors and condenses Frontiers chapter
Improves the Frontiers chapter by removing redundant, speculative, and non-essential content, resulting in a more focused and academically rigorous presentation.

This includes:
- Deleting entire sections (Integrated Development Framework, Speculative Timeline, Career Paths) deemed unnecessary by expert reviewers.
- Consolidating redundant introductions and sections.
- Condensing verbose descriptions of opportunities and AGI applications.

These changes address reviewer feedback regarding clarity, focus, and academic tone, while maintaining technical depth.
2025-11-09 12:09:28 -05:00
github-actions[bot]
c37fa6b079 Update contributors list [skip ci] 2025-11-07 21:12:13 +00:00
Vijay Janapa Reddi
a85e55dd04 Merge remote-tracking branch 'origin/dev' into dev 2025-11-07 16:07:27 -05:00
Vijay Janapa Reddi
3826c90113 fix: standardize matrix multiplication convention across all chapters
Resolved major inconsistency in matrix multiplication notation throughout
the textbook. Previously used two conflicting conventions:
- Convention A (inconsistent): Z = W·A (weight on left)
- Convention B (now standard): Z = A·W (activation on left)

Adopted Convention B throughout to match PyTorch/TensorFlow conventions
and provide intuitive batch-first processing where inputs are (batch×features)
and weights are (input_dim×output_dim).

Changes in dl_primer.qmd:
- Forward propagation equations: Changed Z^(l) = W^(l)·A^(l-1) to A^(l-1)·W^(l)
- Dimension specifications: Changed weight matrices from (output×input) to (input×output)
- Gradient equations: Updated backprop formulas to match new convention
  * Weight gradients: (A^(l-1))^T · ∂L/∂Z^(l)
  * Input gradients: ∂L/∂Z^(l) · (W^(l))^T
- Weight matrix description: Clarified row vs column interpretation
- Self-check questions: Updated all equation references

Changes in dnn_architectures.qmd:
- MLP layer equation: Changed h^(l) = f(W^(l)·h^(l-1) + b) to h^(l-1)·W^(l)
- Weight matrix dimensions: Changed from R^(d_out×d_in) to R^(d_in×d_out)
- Concrete example: Transposed 3×4 weight matrix to 4×3 to match convention
- Removed unnecessary transposes from computation examples

All numerical examples verified correct (784×100, 100×100, 100×10 for
MNIST example). No linter errors introduced.

Addresses #1041

Co-authored-by: jianqingdu <jianqing.du@live.cn>
2025-11-07 10:52:25 -05:00
github-actions[bot]
850b2cd23e Update contributors list [skip ci] 2025-11-07 13:51:52 +00:00
Vijay Janapa Reddi
11ea5e7717 Merge remote-tracking branch 'origin/dev' into dev 2025-11-07 08:47:17 -05:00
Vijay Janapa Reddi
d3467b8064 fix(dl_primer): correct output weight matrix dimensions
Changed the output layer weight matrix W^(L) from n_(L-1) × 10 to
10 × n_(L-1) to match the mathematical formulation and maintain
consistency with the pattern used for all other layers (output_dim × input_dim).

Closes #1041

Co-authored-by: jianqingdu <jianqing.du@live.cn>
2025-11-07 08:46:17 -05:00
Nimo
2b1be6fe83 Suggest an alternate research article (#1040)
* Update TinyML report reference in bibliography

The original url gives 404. I couldn't find another unpaid link on that website. Suggested replacement.

* Change source reference in ML systems documentation

Updated source reference for the Distributed Intelligence Spectrum description.

* Replace market growth report with ABI research report

Replaced to the originally intended article/wp

* Change source reference in ml_systems.qmd

Updated source reference for the Distributed Intelligence Spectrum description.
2025-11-07 08:40:57 -05:00
Vijay Janapa Reddi
4a3a3df85a Refine wording in 'Why This Book Exists' section 2025-11-06 15:53:01 -05:00
Vijay Janapa Reddi
b715eb1b53 Revise wording in 'Why This Book Exists' section 2025-11-06 15:50:10 -05:00
github-actions[bot]
d638565832 Update contributors list [skip ci] 2025-11-06 19:22:37 +00:00
Didier Durand
39bde7770d Fixing typos re. spelling of Ultralytics library (#1039) 2025-11-06 14:17:26 -05:00
github-actions[bot]
a64fad7f4d Update contributors list [skip ci] 2025-11-06 13:57:28 +00:00
Didier Durand
86e2f25a0b Fixing typos in labs section (#1038) 2025-11-06 08:52:55 -05:00
Vijay Janapa Reddi
1bd42eba6b Removes duplicate words in DL primer (#1037)
Addresses #1036
2025-11-06 07:17:00 -05:00
Vijay Janapa Reddi
7995d89da2 docs(frontiers): improve math formatting and add chain-of-thought citation
- Formatted state space model equations using LaTeX math blocks with alignment
- Added Wei et al. 2022 chain-of-thought prompting citation
- Improves readability and proper citation of key techniques
2025-11-05 18:58:42 -05:00
Vijay Janapa Reddi
1effa5d06f refactor(deploy): simplify PDF/EPUB links to direct asset paths
Addresses #1016

Simplified approach:
- Removed pdf.html and epub.html redirect files (unnecessary complexity)
- Changed navbar links to direct asset paths
- Dev builds: Direct links to assets/downloads/ (simpler, no redirects)
- Production: Netlify still provides /pdf and /epub vanity URLs via netlify.toml

This is cleaner because:
- No extra HTML redirect files to maintain
- Dev users don't need vanity URLs (it's for testing)
- Production keeps short URLs via Netlify server redirects
- Fewer moving parts, less complexity
2025-11-05 18:40:37 -05:00
Vijay Janapa Reddi
0201c96806 fix(build): ensure HTML redirect files are included in build output
Addresses #1016

Added resources configuration to include pdf.html and epub.html in the
build output so they are available at /pdf and /epub URLs on GitHub Pages.
2025-11-05 18:38:17 -05:00
Vijay Janapa Reddi
a0945d775d fix(deploy): add HTML redirect files for GitHub Pages
Addresses #1016

Changes:
- Added pdf.html and epub.html as client-side redirect files
- These use meta refresh and JavaScript redirect for GitHub Pages
- Removed _redirects file copying (Netlify-only feature)
- HTML redirects work on GitHub Pages which doesn't support server redirects

GitHub Pages will serve these HTML files at /pdf and /epub URLs, which
then redirect to the actual files in assets/downloads/.
2025-11-05 18:34:10 -05:00