Skip to main content

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() through flowlab6() - Show full lab code workflows
    • flowoel() - 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


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.2.tar.gz (61.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matplotlab-0.1.2-py3-none-any.whl (71.3 kB view details)

Uploaded Python 3

File details

Details for the file matplotlab-0.1.2.tar.gz.

File metadata

  • Download URL: matplotlab-0.1.2.tar.gz
  • Upload date:
  • Size: 61.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for matplotlab-0.1.2.tar.gz
Algorithm Hash digest
SHA256 39f32c5cc632450dfdbaa02acef78d8275f982b3df53c730aa778085be8f94a6
MD5 7f5d457f71ee65ba28510f093bda4277
BLAKE2b-256 d69d1193bf5155a455c90a057db39674a08ed7278aac120c0e8ba8be11234824

See more details on using hashes here.

File details

Details for the file matplotlab-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: matplotlab-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 71.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for matplotlab-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 255705b73aef0a19481fcd9cf187e36417df046358aaf1e8738284e63ea31d4f
MD5 c78b0ac504521eb92f61883e0fccdd50
BLAKE2b-256 4f5156283bee49a94d4909a4ead4295c24b6904ccb1c1bb56960f7926f6de09d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page