Personal collection of algorithms.
Project description
Vicentin
A comprehensive Python library for mathematical optimization, deep learning, computer vision, and classic algorithms. This library is designed with a dual-backend architecture, offering seamless switching between NumPy for transparency and PyTorch for hardware acceleration and automatic differentiation.
Table of Contents
Introduction
vicentin is a Python package that contains my personal implementations of a variety of algorithms, data structures, and optimization techniques. It serves as a collection of theoretical and practical programming concepts.
Features
- Data Structures: Queue, Stack, Tree, Graph, Heap, Priority Queue, Trie, Union Find
- Dynamic Programming: Knapsack, Matrix Multiplication, Rod Cutting, Edit Distance
- Graph Algorithms: Minimum Spanning Tree (MST), Shortest Path, Negative Cycle Detection
- Image & Video Processing: Optical Flow (Horn-Schunck), Differentiation, Regularization, Image-to-Graph
- Optimization: Gradient Descent, Newton's Method, Barrier Method, Proximal Gradient Descent, ISTA, Projected Gradient Descent, Newton-Raphson (Root Finding)
- Machine Learning:
- Kernels
- Unsupervised Learning: PCA
- Classification: Logistic Regression, SVM
- Regression: Ridge Regression
- Deep Learning:
- Models: Autoencoders (AE), Variational Autoencoders (VAE)
- Trainers: Standard, Supervised, GAN, Distillation
- Losses: Beta-VAE, Wasserstein GAN
- Sorting: Heap Sort
- Mathematical Tools: Polynomial Operations
- Papers: Grad-CAM, SimCLR
Installation
1️⃣ Clone the Repository
git clone https://github.com/your-username/vicentin.git
cd vicentin
2️⃣ Set Up a Virtual Environment
python -m venv venv
source venv/bin/activate
3️⃣ Install Dependencies
pip install -r requirements.txt
Usage
Heap data structure
# Example: Using the heap data structure
from vicentin.data_structures.heap import Heap
heap = Heap()
heap.insert(5)
heap.insert(2)
heap.insert(8)
print(heap.extract_min()) # Output: 2
Newton's Method
import torch
from vicentin.optimization.minimization import newton_method
def objective(x):
return torch.sum(x**2)
x0 = torch.tensor([10.0, 10.0])
A = torch.tensor([[1.0, 1.0]])
b = torch.tensor([1.0])
# Backend (Torch) is automatically detected from x0
x_opt = newton_method(objective, x0, equality=(A, b))
print(f"Optimal solution: {x_opt}")
Pre-commit Setup
This repository uses pre-commit to enforce coding standards, automatic formatting and automatic version bumping before commits.
1️⃣ Install pre-commit
pip install pre-commit
2️⃣ Install Hooks
pre-commit install
3️⃣ Use commitizen to commit
cz commit
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vicentin-1.6.22.tar.gz.
File metadata
- Download URL: vicentin-1.6.22.tar.gz
- Upload date:
- Size: 112.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df10acd23f3d4cc01950677bf01033c63f1755d17c16fb4aff8a952570ea972d
|
|
| MD5 |
02972734617e6d049ad51180e9ae89b9
|
|
| BLAKE2b-256 |
1d5ae2584d6901d2f551067ff9fd0653673e1b8b98f736e8ec219d88860417cc
|
File details
Details for the file vicentin-1.6.22-py3-none-any.whl.
File metadata
- Download URL: vicentin-1.6.22-py3-none-any.whl
- Upload date:
- Size: 186.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2705faaf3494e087b31cbe50eceda56546e872962f8f8a01cd18af79ba30862d
|
|
| MD5 |
92219aba0ff35fe5e423b388ae2f28da
|
|
| BLAKE2b-256 |
52be414694cd280709c9887792430db31307ad1d30ba0df8092bd32ef4231107
|