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.3.tar.gz (81.4 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.3-py3-none-any.whl (93.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: matplotlab-0.1.3.tar.gz
  • Upload date:
  • Size: 81.4 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.3.tar.gz
Algorithm Hash digest
SHA256 b9e0dbf77fe9c3af6d90ccb1512e3783108c2e6504658d3b1ac8978a8efea108
MD5 2b1c5b6ce23e1c5d319922c3af10a974
BLAKE2b-256 eb9f7081f1b10324f27e2465463cd0c56fe96fc4dcf4ce0101d0b4a46c694c99

See more details on using hashes here.

File details

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

File metadata

  • Download URL: matplotlab-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 93.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 564bc596acfab5eed68b31c603d161b55bb9dd1597f082599e56194c24f1aeb9
MD5 859a718889d5cd3717a6cfdc4de02324
BLAKE2b-256 04e49dc033f3b594708beca59672b59200bafc6f8a97aaf66967fa7ede309d4d

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