Skip to content

Commit 6e485c4

Browse files
committed
add: table of content
1 parent 61ffaa7 commit 6e485c4

1 file changed

Lines changed: 116 additions & 37 deletions

File tree

README.md

Lines changed: 116 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,100 @@
1+
<div align="center">
12

2-
#### **A comprehensive implementation of various Matrix Decomposition Techniques from the lens of Linear Algebra to produce efficient computing of SVD, PCA, Feature Selection & Data Analysis in Python.**
3-
______________________________________________________________________
3+
# Matrix Decomposition Implemenations
44

5-
To gain a deeper understanding of how Orthogonalization & Matrices Decomposition works in real-life applications, & how they save bunch of time through an approach of vectorization, you'll find such techniques used in;
5+
**A hands-on marimo built, math-first implementations of Matrix Decomposition Functions,**
6+
**find the notebooks; hosting on molab & hf-spaces.**
67

7-
- **📡 Signal Processing**
8-
- **🤖 Control Systems and Robotics**
9-
- **🖼️ Image Processing**
10-
- **➗ Solving Linear Systems i.e. *AX = B***
8+
<br/>
119

12-
With certain mathematical intuitions (*having visual introspections*),this project simplifies most of the abstract concepts and becomes easier to grasp and connect with practical applications.
10+
[![Open in molab](https://marimo.io/molab-shield.svg)](https://molab.marimo.io/github/https://molab.marimo.io/notebooks/nb_TAVLehyiE58b5RDzjxFxSW/app)
11+
[![Open in Spaces](https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-sm.svg)](https://huggingface.co/spaces)
12+
[![Python](https://img.shields.io/badge/Python-3.11%2B-4F46E5?style=flat&logo=python&logoColor=white)](https://www.python.org/)
13+
[![NumPy](https://img.shields.io/badge/NumPy-2.0%2B-7C3AED?style=flat&logo=numpy&logoColor=white)](https://numpy.org/)
14+
[![License](https://img.shields.io/badge/License-Apache_2.0-1E293B?style=flat&logo=apache&logoColor=white)](https://opensource.org/licenses/Apache-2.0)
1315

14-
![a snippet of notebook](.assets/matrix_snippet.gif)
16+
<img src=".assets/01.gif" alt="Matrix Decompositions Demo" width="620"/>
1517

16-
> You'll yet to see more implementations—such as **Householder Reflection**, **Bidiagonalization**, **LU Decomposition**, on this repo, and others—*these will be added soon*.
18+
</div>
1719

18-
## What's Inside
20+
## Table of Contents
1921

20-
*By latest ✨,*
22+
- [Overview](#overview)
23+
- [Marimo Apps](#marimo-apps)
24+
- [Quickstart](#quickstart)
25+
- [Implementation Notes](#implementation-notes)
26+
- [Contributing](#contributing)
27+
- [Resources \& Acknowledgements](#resources--acknowledgements)
2128

22-
The **Gram-Schmidt Orthogonalization** is one of the fundamental process in Linear Algebra to achieve *Orthonormal Vectors* for a given vector space. The Orthonormal Basis are produced by iteratively removing vector projections — also known as the *Vector Projection Elimination method*.
2329

24-
**Terms like Orthogonality, QR Decomposition are being discussed in the — [🗨️Discussion section](https://github.com/PragyanTiwari/Matrix-Decompositions-Implementation-for-SVD-PCA/discussions).**
30+
## Overview
2531

26-
Here's a snippet;
32+
A curated set of [marimo](https://marimo.io) notebooks based on **Matrix Decomposition** functions, written in Python, each pairing a mathematical derivation with annotated Python including an interactive visualization, inside a single reactive environment.
33+
34+
The series is a progressive build, starting from orthogonalization fundamentals and working toward full matrix factorizations and applications:
35+
36+
`Gram-Schmidt``QR``LU``Householder``SVD``PCA`
37+
38+
> These functions reduce computationally expensive operations i.e. inversion, least squares, eigensolving, into sequences of simpler, numerically stable factors.
39+
40+
>> Applications such as **noise reduction, signal processing, image compression** and more will be covered as the series progresses.
41+
42+
## Marimo Apps
43+
44+
| Notebook | Open in molab | Open in HF Spaces |
45+
|---|:---:|:---:|
46+
| **Gram-Schmidt Orthogonalization** | [![Open in molab](https://molab.marimo.io/molab-shield.svg)](https://molab.marimo.io/notebooks/nb_TAVLehyiE58b5RDzjxFxSW/app) | [![Open in Spaces](https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-sm.svg)](https://huggingface.co/spaces) |
47+
| **QR Decomposition** | 🔜 | 🔜 |
48+
| **Householder Reflection & Bidiagonalization** | 🔜 | 🔜 |
49+
50+
## Quickstart
51+
52+
Requires Python `>= 3.12` and [`uv`](https://docs.astral.sh/uv/).
53+
54+
**1. Clone and install dependencies**
55+
56+
```bash
57+
git clone https://github.com/prgyn8/Matrix-Decomposition-Implementations.git
58+
uv sync
59+
```
60+
61+
**2. Run a marimo app**, (eg. gram-schmidt process)
62+
63+
```bash
64+
uvx marimo run apps/gs_process.py # you can find the available notebooks in the apps directory.
65+
```
66+
67+
**3. Optionally, run a notebook in sandbox environment**
2768

2869
```bash
29-
def gs_Orthogonalization(X:np.ndarray)->np.ndarray:
70+
# Run the app
71+
uvx marimo run --sandbox apps/gs_process.py
3072

73+
# Or open for editing
74+
uvx marimo edit --sandbox apps/gs_process.py
75+
```
76+
77+
---
78+
79+
## Implementation Notes
80+
81+
<details>
82+
83+
<summary><strong>Gram-Schmidt Orthogonalization</strong></summary>
84+
85+
<br/>
86+
87+
```python
88+
## snippet from the notebook : https://molab.marimo.io/notebooks/nb_TAVLehyiE58b5RDzjxFxSW
89+
def gram_schmidt(X:np.ndarray)->np.ndarray:
90+
91+
"""
92+
original -> orthogonal -> orthonormal
93+
args:
94+
A set of linearly independent vectors stored in columns in the array X.
95+
returns:
96+
Returns matrix Q of the shape of X, having orthonormal vectors for the given vectors.
97+
"""
3198
Q = np.copy(X).astype("float64")
3299
n_vecs = Q.shape[1]
33100

@@ -58,38 +125,50 @@ def gs_Orthogonalization(X:np.ndarray)->np.ndarray:
58125
return Q
59126
```
60127

61-
To run the notebook in a sandbox environment;
62-
63-
```bash
64-
uvx marimo run --sandbox notebooks/Gram_Schmidt_QR_Decomposition.py
128+
```python
129+
# Verification: Q.T @ Q ≈ I
130+
A = np.array([[1, 0, 0], [2, 0, 3], [4, 5, 6]]).T
131+
assert np.allclose(gram_schmidt(A).T @ gram_schmidt(A), np.eye(3)) #
65132
```
66133

67-
## 🧪 Testing
134+
> 💬 Questions on implementation or numerical stability? Start a thread in [Discussions](https://github.com/prgyn8/Matrix-Decomposition-Implementations/discussions).
68135
69-
The updates made on this project, can be tested for deployment, (and for personal experimentation) by the following;
136+
</details>
70137

71-
- Fork the repository.
138+
---
72139

73-
- Run uv sync to install dependencies (*uv lockfile will help*)
140+
## Contributing
74141

75-
```bash
76-
uv sync
77-
```
142+
Contributions are welcome, whether it's a bug report, a new decomposition technique, or a clearer explanation of the math.
78143

79-
- To test the export process, we'll run `.github/scripts/build.py` from the root directory through a symlink.
144+
1. **Fork** the repository
145+
2. **Sync** dependencies: `uv sync`
146+
3. **Create a branch** for your changes
147+
4. **Open a Pull Request** — maintainers will review it
80148

81-
```bash
82-
uv run .github/scripts/build.py
83-
```
149+
For questions, suggestions, or discussion of the mathematics:
150+
151+
- 💬 [Discussion Board](https://github.com/prgyn8/Matrix-Decomposition-Implementations/discussions)
152+
- 🐛 [Open an Issue](https://github.com/prgyn8/Matrix-Decomposition-Implementations/issues)
153+
154+
---
155+
156+
## Resources & Acknowledgements
84157

85-
This will export all notebooks in a folder called `_site/` in the root directory
158+
- [**Wikipedia** — Gram-Schmidt Process](https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process) — foundational definitions and mathematical references
159+
- [**DataCamp** — Orthogonal Matrices](https://www.datacamp.com/tutorial/orthogonal-matrix) — accessible article on orthogonality
160+
- [**MIT OpenCourseWare** — Lecture 17](https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/resources/lecture-17-orthogonal-matrices-and-gram-schmidt/) — in-depth treatment by *Prof. Gilbert Strang*
161+
- [**Steve Brunton**](https://www.youtube.com/@Eigensteve) — original spark for this project; exceptional intuition on engineering applications of linear algebra
162+
- [**Graphical Linear Algebra**](https://graphicallinearalgebra.net/2017/08/09/orthogonality-and-projections/) — visual treatment of orthogonality and projections
86163

87-
## 🌱 Contribution Guide
164+
---
88165

89-
- If you find a bug or have a feature request, please open an [Issue](https://github.com/PragyanTiwari/Matrix-Decompositions-Implementation-for-SVD-PCA/issues).
166+
<div align="center">
90167

91-
- PR will be reviewed by the maintainers.
168+
<br/>
92169

93-
- Questions & Suggestions can be queried on the [Discussion section](https://github.com/PragyanTiwari/Matrix-Decompositions-Implementation-for-SVD-PCA/discussions).
170+
[⭐ Star this repo](https://github.com/prgyn8/Matrix-Decomposition-Implementations/stargazers) &nbsp;·&nbsp;
171+
[💬 Join the Discussion](https://github.com/prgyn8/Matrix-Decomposition-Implementations/discussions) &nbsp;·&nbsp;
172+
[Author →](https://github.com/prgyn8)
94173

95-
______________________________________________________________________
174+
</div>

0 commit comments

Comments
 (0)