Skip to content

Commit 8629804

Browse files
Copilotkamalsaleh
authored andcommitted
Major restructuring of the package
including improved documentation and a rename to GradientBasedLearningForCAP. Bump version: v2026.01-01
1 parent 117d722 commit 8629804

107 files changed

Lines changed: 8789 additions & 7533 deletions

File tree

Some content is hidden

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

.github/workflows/Tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ jobs:
4747
cp -a $GITHUB_WORKSPACE /home/gap/.gap/pkg/
4848
- name: Prepare environment
4949
run: |
50-
cp ./GradientDescentForCAP/dev/ci_gaprc /home/gap/.gap/gaprc
51-
git clone --depth 1 -vv https://github.com/gap-packages/AutoDoc.git
50+
cp ./GradientBasedLearningForCAP/dev/ci_gaprc /home/gap/.gap/gaprc
5251
git clone --depth 1 -vv https://github.com/homalg-project/homalg_project.git
5352
git clone --depth 1 -vv https://github.com/homalg-project/CAP_project.git
5453
git clone --depth 1 -vv https://github.com/homalg-project/CategoricalTowers.git
@@ -59,18 +58,19 @@ jobs:
5958
if [ -d "CAP_project/CompilerForCAP" ]; then make -C "CAP_project/CompilerForCAP" doc; fi
6059
if [ -d "CAP_project/MonoidalCategories" ]; then make -C "CAP_project/MonoidalCategories" doc; fi
6160
if [ -d "CAP_project/CartesianCategories" ]; then make -C "CAP_project/CartesianCategories" doc; fi
61+
if [ -d "CAP_project/AdditiveClosuresForCAP" ]; then make -C "CAP_project/AdditiveClosuresForCAP" doc; fi
6262
if [ -d "CAP_project/FreydCategoriesForCAP" ]; then make -C "CAP_project/FreydCategoriesForCAP" doc; fi
6363
if [ -d "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" ]; then make -C "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" doc; fi
6464
if [ -d "homalg_project/homalg" ]; then make -C "homalg_project/homalg" doc; fi
6565
if [ -d "homalg_project/Modules" ]; then make -C "homalg_project/Modules" doc; fi
6666
if [ -d "CategoricalTowers/ToolsForCategoricalTowers" ]; then make -C "CategoricalTowers/ToolsForCategoricalTowers" doc; fi
6767
if [ -d "CategoricalTowers/Toposes" ]; then make -C "CategoricalTowers/Toposes" doc; fi
68-
- name: Test GradientDescentForCAP
68+
- name: Test GradientBasedLearningForCAP
6969
run: |
70-
make -C GradientDescentForCAP --trace -j $(nproc) --output-sync ci-test
70+
make -C GradientBasedLearningForCAP --trace -j $(nproc) --output-sync ci-test
7171
- name: Release package or simulate release
7272
run: |
73-
cd GradientDescentForCAP
73+
cd GradientBasedLearningForCAP
7474
python3 dev/process_coverage.py
7575
git config --global user.name "Bot"
7676
git config --global user.email "empty"
@@ -88,5 +88,5 @@ jobs:
8888
env:
8989
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
9090
run: |
91-
cd GradientDescentForCAP
91+
cd GradientBasedLearningForCAP
9292
./dev/upload_codecov.sh

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
/doc/*.xml
3232
/doc_tmp/
3333
/stats
34-
/tst/machinelearningforcap*.tst
34+
/tst/gradientbasedlearningforcap*.tst

PackageInfo.g

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
2-
# GradientDescentForCAP: Exploring categorical machine learning in CAP
2+
# GradientBasedLearningForCAP: Gradient Based Learning via Category Theory
33
#
44
# This file contains package meta data. For additional information on
55
# the meaning and correct usage of these fields, please consult the
@@ -8,9 +8,9 @@
88
#
99
SetPackageInfo( rec(
1010

11-
PackageName := "GradientDescentForCAP",
12-
Subtitle := "Exploring categorical machine learning in CAP",
13-
Version := "2025.11-01",
11+
PackageName := "GradientBasedLearningForCAP",
12+
Subtitle := "Gradient Based Learning via Category Theory",
13+
Version := "2026.01-01",
1414
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
1515
License := "GPL-2.0-or-later",
1616

@@ -34,13 +34,13 @@ Persons := [
3434
# BEGIN URLS
3535
SourceRepository := rec(
3636
Type := "git",
37-
URL := "https://github.com/homalg-project/GradientDescentForCAP",
37+
URL := "https://github.com/homalg-project/GradientBasedLearningForCAP",
3838
),
3939
IssueTrackerURL := Concatenation( ~.SourceRepository.URL, "/issues" ),
40-
PackageWWWHome := "https://homalg-project.github.io/pkg/GradientDescentForCAP",
41-
PackageInfoURL := "https://homalg-project.github.io/GradientDescentForCAP/PackageInfo.g",
42-
README_URL := "https://homalg-project.github.io/GradientDescentForCAP/README.md",
43-
ArchiveURL := Concatenation( "https://github.com/homalg-project/GradientDescentForCAP/releases/download/v", ~.Version, "/GradientDescentForCAP-", ~.Version ),
40+
PackageWWWHome := "https://homalg-project.github.io/pkg/GradientBasedLearningForCAP",
41+
PackageInfoURL := "https://homalg-project.github.io/GradientBasedLearningForCAP/PackageInfo.g",
42+
README_URL := "https://homalg-project.github.io/GradientBasedLearningForCAP/README.md",
43+
ArchiveURL := Concatenation( "https://github.com/homalg-project/GradientBasedLearningForCAP/releases/download/v", ~.Version, "/GradientBasedLearningForCAP-", ~.Version ),
4444
# END URLS
4545

4646
ArchiveFormats := ".tar.gz .zip",
@@ -58,16 +58,16 @@ Status := "dev",
5858
AbstractHTML := "",
5959

6060
PackageDoc := rec(
61-
BookName := "GradientDescentForCAP",
61+
BookName := "GradientBasedLearningForCAP",
6262
ArchiveURLSubset := ["doc"],
6363
HTMLStart := "doc/chap0.html",
6464
PDFFile := "doc/manual.pdf",
6565
SixFile := "doc/manual.six",
66-
LongTitle := "Exploring categorical machine learning in CAP",
66+
LongTitle := "Gradient Based Learning via Category Theory",
6767
),
6868

6969
Dependencies := rec(
70-
GAP := ">= 4.15.1",
70+
GAP := ">= 4.13.0",
7171
NeededOtherPackages := [
7272
[ "GAPDoc", ">= 1.5" ],
7373
[ "CAP", ">= 2024.09-12" ],

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- BEGIN HEADER -->
2-
# GradientDescentForCAP&ensp;<sup><sup>[![View code][code-img]][code-url]</sup></sup>
2+
# GradientBasedLearningForCAP&ensp;<sup><sup>[![View code][code-img]][code-url]</sup></sup>
33

4-
### Exploring categorical machine learning in CAP
4+
### Gradient Based Learning via Category Theory
55

66
| Documentation | Latest Release | Build Status | Code Coverage |
77
| ------------- | -------------- | ------------ | ------------- |
@@ -22,25 +22,25 @@ To obtain current versions of all dependencies, `git clone` (or `git pull` to up
2222
| 3. | [**CategoricalTowers**](https://github.com/homalg-project/CategoricalTowers#readme) | https://github.com/homalg-project/CategoricalTowers.git |
2323

2424
[html-img]: https://img.shields.io/badge/🔗%20HTML-stable-blue.svg
25-
[html-url]: https://homalg-project.github.io/GradientDescentForCAP/doc/chap0_mj.html
25+
[html-url]: https://homalg-project.github.io/GradientBasedLearningForCAP/doc/chap0_mj.html
2626

2727
[pdf-img]: https://img.shields.io/badge/🔗%20PDF-stable-blue.svg
28-
[pdf-url]: https://homalg-project.github.io/GradientDescentForCAP/download_pdf.html
28+
[pdf-url]: https://homalg-project.github.io/GradientBasedLearningForCAP/download_pdf.html
2929

30-
[version-img]: https://img.shields.io/endpoint?url=https://homalg-project.github.io/GradientDescentForCAP/badge_version.json&label=🔗%20version&color=yellow
31-
[version-url]: https://homalg-project.github.io/GradientDescentForCAP/view_release.html
30+
[version-img]: https://img.shields.io/endpoint?url=https://homalg-project.github.io/GradientBasedLearningForCAP/badge_version.json&label=🔗%20version&color=yellow
31+
[version-url]: https://homalg-project.github.io/GradientBasedLearningForCAP/view_release.html
3232

33-
[date-img]: https://img.shields.io/endpoint?url=https://homalg-project.github.io/GradientDescentForCAP/badge_date.json&label=🔗%20released%20on&color=yellow
34-
[date-url]: https://homalg-project.github.io/GradientDescentForCAP/view_release.html
33+
[date-img]: https://img.shields.io/endpoint?url=https://homalg-project.github.io/GradientBasedLearningForCAP/badge_date.json&label=🔗%20released%20on&color=yellow
34+
[date-url]: https://homalg-project.github.io/GradientBasedLearningForCAP/view_release.html
3535

36-
[tests-img]: https://github.com/homalg-project/GradientDescentForCAP/actions/workflows/Tests.yml/badge.svg?branch=master
37-
[tests-url]: https://github.com/homalg-project/GradientDescentForCAP/actions/workflows/Tests.yml?query=branch%3Amaster
36+
[tests-img]: https://github.com/homalg-project/GradientBasedLearningForCAP/actions/workflows/Tests.yml/badge.svg?branch=master
37+
[tests-url]: https://github.com/homalg-project/GradientBasedLearningForCAP/actions/workflows/Tests.yml?query=branch%3Amaster
3838

39-
[codecov-img]: https://codecov.io/gh/homalg-project/GradientDescentForCAP/branch/master/graph/badge.svg
40-
[codecov-url]: https://app.codecov.io/gh/homalg-project/GradientDescentForCAP
39+
[codecov-img]: https://codecov.io/gh/homalg-project/GradientBasedLearningForCAP/branch/master/graph/badge.svg
40+
[codecov-url]: https://app.codecov.io/gh/homalg-project/GradientBasedLearningForCAP
4141

4242
[code-img]: https://img.shields.io/badge/-View%20code-blue?logo=github
43-
[code-url]: https://github.com/homalg-project/GradientDescentForCAP#top
43+
[code-url]: https://github.com/homalg-project/GradientBasedLearningForCAP#top
4444
<!-- END FOOTER -->
4545

4646
### Running the Package with Docker
@@ -93,7 +93,7 @@ In this example, we consider a training dataset consisting of the three points
9393

9494
We aim to compute a line that fits $\mathcal{D}$.
9595
```julia
96-
gap> LoadPackage( "GradientDescentForCAP" );
96+
gap> LoadPackage( "GradientBasedLearningForCAP" );
9797
true
9898

9999
gap> Para := CategoryOfParametrisedMorphisms( SkeletalSmoothMaps );
@@ -288,7 +288,7 @@ To facilitate this classification, we use a one-hot encoding scheme for the labe
288288
That is, the training set (the set of labeled exmaples) is a finite subset of $\mathbb{R}^2 \times \mathbb{R}^3 \simeq \mathbb{R}^5$.
289289

290290
```julia
291-
gap> LoadPackage( "GradientDescentForCAP" );
291+
gap> LoadPackage( "GradientBasedLearningForCAP" );
292292
true
293293

294294
gap> Para := CategoryOfParametrisedMorphisms( SkeletalSmoothMaps );

dev/.release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sed "s;Date := .*;Date := \"$(date -I)\",;" PackageInfo.g > PackageInfo.g.bak
1414
mv PackageInfo.g.bak PackageInfo.g
1515

1616
# replace links to packages which are possibly referenced in the documentation, keep this in sync with `Tests.yml.j2`
17-
for package in CAP_project/CAP CAP_project/CompilerForCAP CAP_project/MonoidalCategories CAP_project/CartesianCategories CAP_project/FreydCategoriesForCAP HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra homalg_project/homalg homalg_project/Modules CategoricalTowers/ToolsForCategoricalTowers CategoricalTowers/Toposes; do
17+
for package in CAP_project/CAP CAP_project/CompilerForCAP CAP_project/MonoidalCategories CAP_project/CartesianCategories CAP_project/AdditiveClosuresForCAP CAP_project/FreydCategoriesForCAP HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra homalg_project/homalg homalg_project/Modules CategoricalTowers/ToolsForCategoricalTowers CategoricalTowers/Toposes GradientBasedLearningForCAP; do
1818

1919
# adjust links to other manuals
2020
# Note that we cannot use sed's `-i` option for in-place editing, as

dev/upload_codecov.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ curl -O https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
2121
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
2222
shasum -a 256 -c codecov.SHA256SUM
2323

24+
# read the token
25+
if [ -z "$CODECOV_TOKEN" ]; then
26+
echo -e "\033[0;33mCODECOV_TOKEN is not set. Proceeding without token.\033[0m"
27+
else
28+
echo -e "\033[0;32mUsing CODECOV_TOKEN from environment variable.\033[0m"
29+
fi
30+
2431
# execute
2532
chmod +x codecov
2633
while ! ./codecov -Z -v -s ../ -t $CODECOV_TOKEN; do
27-
echo "Codecov upload failed, retrying in 20s"
28-
sleep 20
34+
echo "Codecov upload failed, retrying in 60s"
35+
sleep 60
2936
done

doc/Doc.autodoc

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,101 @@
1-
@Chapter Examples and Tests
1+
@Chapter Introduction
2+
3+
This package provides tools for exploring categorical machine learning using the CAP (Categories, Algorithms, Programming) system.
4+
It implements automatic differentiation using the lens pattern and provides constructs for building and training neural networks.
5+
6+
@Section Overview
7+
8+
The package implements the following main concepts:
9+
10+
* **Examples**: Examples for creating and training neural networks.
11+
12+
* **Expressions**: A symbolic expression system for representing mathematical formulas.
13+
14+
* **Skeletal Category of Smooth Maps**: A category where objects are Euclidean spaces $\mathbb{R}^n$ and morphisms are smooth maps with their Jacobian matrices.
15+
16+
* **Category of Parametrised Morphisms**: A category that represents morphisms with learnable parameters, used to model neural network layers.
17+
18+
* **Neural Networks**: High-level operations for constructing and training neural networks.
19+
20+
* **Category of Lenses**: A category that models bidirectional data flow, essential for backpropagation in neural networks.
21+
22+
* **Fitting Parameters**: Explain how to learn the parameters in order to minimize a parametrised morphism.
23+
24+
* **CAP Operation**: The new categorical operations needed in this package.
25+
26+
* **Tools**: Few GAP operations and helper functions.
27+
28+
29+
@Chapter Examples for neural networks
30+
31+
@Section Binary-class neural network with binary cross-entropy loss function
32+
@Section Multi-class neural network with cross-entropy loss function
33+
@Section Neural network with quadratic loss function
34+
35+
@Chapter Expressions
36+
37+
@Section Constructors
38+
@Section Attributes
39+
@Section Operations
40+
@Section Global Functions
41+
@Section Examples
42+
@Section GAP Categories
43+
44+
@Chapter Skeletal Category of Smooth Maps
45+
46+
@Section Constructors
47+
@Section Attributes
48+
@Section Operations
49+
@Section Available Smooth Maps
50+
@Section Supported CAP Operations
51+
@Section Examples
52+
@Section GAP Categories
53+
54+
@Chapter Category of Parametrised Morphisms
55+
56+
@Section Definition
57+
@Section Constructors
58+
@Section Attributes
59+
@Section Operations
60+
@Section Available Parametrised Morphisms
61+
@Section Supported CAP Operations
62+
@Section Examples
63+
@Section GAP Categories
64+
65+
@Chapter Neural Networks
66+
67+
@Section Definition
68+
@Section Operations
69+
@Section Examples
70+
71+
@Chapter Category of Lenses
72+
73+
@Section Definition
74+
@Section Constructors
75+
@Section Attributes
76+
@Section Operations
77+
@Section Available Lenses
78+
@Section Optimizers
79+
@Section Supported CAP Operations
80+
@Section Examples
81+
@Section GAP Categories
82+
83+
84+
@Chapter Fitting Parameters
85+
86+
@Section Introduction
87+
@Section Notes on Batching
88+
@Section Operations
89+
@Section Examples
90+
91+
@Chapter CAP Operations for GradientBasedLearningForCAP
92+
93+
@Section Basic Operations
94+
@Section Add-Methods
95+
96+
@Chapter Tools
97+
98+
@Section Mathematical Operations
99+
@Section List Operations
100+
@Section Helper Functions
101+
@Section Python Integration

0 commit comments

Comments
 (0)