Extended plotting and ML utilities library
Project description
Matplotlab
Extended plotting and machine learning utilities library for educational purposes.
A comprehensive Python library providing:
- Reinforcement Learning (RL) - Monte Carlo, TD Learning, Policy/Value Iteration, Dynamic Programming
- Artificial Neural Networks (ANN) - Deep Learning implementations with PyTorch and TensorFlow
- Visualization Tools - Enhanced plotting capabilities for ML workflows
Installation
# Install from PyPI
pip install matplotlab
# Or install from source
git clone https://github.com/Sohail-Creates/matplotlab.git
cd matplotlab
pip install -e .
Quick Start
Reinforcement Learning
from matplotlab import rl
# Create environment and find optimal policy
env = rl.create_frozenlake_env()
policy, V, iterations = rl.policy_iteration(env, gamma=0.99)
print(f"Converged in {iterations} iterations")
# Visualize results
rl.plot_value_heatmap(V)
rl.plot_grid_policy(policy)
# NEW: See complete lab workflow (Lab 1-6 + OEL)
rl.flowlab3() # Shows complete Lab 3 code from import to visualization
rl.flowlab5() # Shows complete Lab 5 (Policy Iteration) workflow
Artificial Neural Networks
from matplotlab import ann
import torch.nn as nn
# Create simple MLP model
model = ann.create_mlp_model(input_size=10, hidden_sizes=[16, 8], output_size=1)
# Or create CNN
cnn_model = ann.create_fashion_cnn()
# Training is straightforward
for epoch in range(50):
y_pred = model(X_train)
loss = loss_fn(y_pred, y_train)
optimizer.zero_grad()
loss.backward()
optimizer.step()
Features
✅ Reinforcement Learning Module (43 functions)
- Environments: FrozenLake, Custom GridWorld
- Algorithms: Monte Carlo, TD Learning, Policy Iteration, Value Iteration
- MDP Utilities: State transitions, reward functions, probability computations
- Visualization: Heatmaps, policy arrows, convergence plots
- Lab Workflows (NEW): Complete code references for Labs 1-6 and OEL
flowlab1()throughflowlab6()- Show full lab code workflowsflowoel()- Complete OEL implementation reference- Perfect for when you forget the sequence of steps!
✅ Artificial Neural Networks Module (76 functions)
- Tensor Operations: PyTorch basics, autograd
- Perceptron: sklearn implementation
- ADALINE: Manual and PyTorch versions
- MLP: Multi-layer perceptron for classification and regression
- CNN: Convolutional neural networks (simple nn.Sequential style)
- Filters: Custom CNN filters with TensorFlow
- Transfer Learning: Pre-trained model fine-tuning
Requirements
- Python >= 3.7
- NumPy >= 1.21.0
- Matplotlib >= 3.4.0
- PyTorch >= 1.10.0 (for ANN module)
- TensorFlow >= 2.8.0 (for CNN filters)
- Scikit-learn >= 1.0.0 (for perceptron)
- Gymnasium >= 0.28.0 (for RL module)
Key Design Philosophy
Simple, Beginner-Friendly Code:
- Uses
nn.Sequential()for neural networks (no complex classes) - Clear variable names:
X_train,y_train,model,loss_fn - Simple for loops and if-else statements
- No lambda functions or advanced Python features
- Easy to understand and modify
Documentation
- 111 total functions (35 RL + 76 ANN)
- Complete docstrings for every function
- Usage examples included
- See documentation files for details
License
MIT License - Free for educational use
Links
For educational purposes | ML/RL implementations made simple
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
matplotlab-0.1.4.tar.gz
(81.6 kB
view details)
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 matplotlab-0.1.4.tar.gz.
File metadata
- Download URL: matplotlab-0.1.4.tar.gz
- Upload date:
- Size: 81.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e2198ba73fc6c7498816f4fc2a8a2e443c6e69517dc3220580ab8003ab552f6
|
|
| MD5 |
dfde7bccac6e09e662d47d459680ed63
|
|
| BLAKE2b-256 |
5bad1f0c15fb92cc0610a141a975f9c4cc99a08dee36607d0e9fe0e2b5aefc67
|
File details
Details for the file matplotlab-0.1.4-py3-none-any.whl.
File metadata
- Download URL: matplotlab-0.1.4-py3-none-any.whl
- Upload date:
- Size: 93.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0d332ead40f1acd67f2b8a8c25343be1f5a272d7cafcd81774daad1c5397065
|
|
| MD5 |
189ca5ef02dd6facea791acbfd47cfb1
|
|
| BLAKE2b-256 |
18eea164046a89c95c8a224791bc31d120d2e0d969149a9dc4597d3ed5b11352
|