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)

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 (35 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

✅ 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.1.tar.gz (53.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.1-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: matplotlab-0.1.1.tar.gz
  • Upload date:
  • Size: 53.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.1.tar.gz
Algorithm Hash digest
SHA256 ea364938108a3bde89a4f13a6796a10a48bdf849f9b58805db2b03ce49c67af9
MD5 9265d57cbf2c3fe5d710be259feba5e0
BLAKE2b-256 9c846186e5feb0fb0815476063ff79bbb20b823e5f21484eaa45fe3c9d27316a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: matplotlab-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 63.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f6ec2daa2fb75f58a363c8cc9765614b2a151805bad680f3c4d03abf7d109df
MD5 077d64bda6d1ce1a5ecec174308c9b4d
BLAKE2b-256 5e6fc3fa723757dba4b1365e4f0996f5d4387b9397eabde5c99d0c601e5b6058

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