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.5.tar.gz (106.8 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.5-py3-none-any.whl (123.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: matplotlab-0.1.5.tar.gz
  • Upload date:
  • Size: 106.8 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.5.tar.gz
Algorithm Hash digest
SHA256 c363143f96d2d7877d92453682fc9177a804fbf2fc5e4390a96b056969f3b3d1
MD5 a7007346666a28ec15feab701ea249d2
BLAKE2b-256 dbed2a3694fe79002569a8c6fcad9bdb8c7a8e6210f50201ea565a7277a74969

See more details on using hashes here.

File details

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

File metadata

  • Download URL: matplotlab-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 123.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b7fe8ab7b6acc38c9914d6f5f07c3e632ea22c655145d9caf891aae4a43cb5e6
MD5 effd108175c2c4a0ddbd7e56212dc500
BLAKE2b-256 8ebe09219578252a9adf0a789a6a3ed4bb5afe032792acb9adfb35613541b420

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