tinygraphs


Nametinygraphs JSON
Version 1.2.2 PyPI version JSON
download
home_pageNone
SummaryA minimal library for plotting training progress in Jupyter/Colab
upload_time2025-01-17 18:10:46
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License Copyright (c) 2024 [YOUR NAME] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords training plotting machine-learning notebook
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![](https://github.com/rkdune/tinygraphs/raw/main/tinyGraphs/images/tinygraphs_header.png)
*A minimal library for plotting training progress in Jupyter/COLAB notebooks.*

## Installation

pip install tinygraphs

## Options

`train_losses`: 
(Required) List of training loss values to plot

`val_losses`: 
(Required) List of validation loss values to plot

`epoch`: 
(Required) Current epoch number for updating the plot

`legend_loc`: 
Location of the legend on the plot (default: "upper right")

`updating_title`: 
Boolean flag to indicate if the title should update with epoch progress (default: True)

`legend`: 
Boolean flag to show/hide the legend (default: True)

`x_label`: 
Label for the x-axis

`y_label`: 
Label for the y-axis

`title`: 
Main title of the plot

`dark_mode`: 
Boolean flag to switch between light and dark themes (default: True)

## Usage

```python

import tinyGraphs as tg

train_losses, val_losses = [], []
epochs = 3

for epoch in range(epochs):
    # Training
    model.train()
    running_train_loss = 0
    for x, y in train_loader:
        x, y = x.to(device), y.to(device)
        optimizer.zero_grad()
        loss = criterion(model(x), y)
        loss.backward()
        optimizer.step()
        running_train_loss += loss.item()
    train_losses.append(running_train_loss / len(train_loader))

    # Validation
    model.eval()
    running_val_loss = 0
    with torch.no_grad():
        for x, y in val_loader:
            x, y = x.to(device), y.to(device)
            loss = criterion(model(x), y)
            running_val_loss += loss.item()
    val_losses.append(running_val_loss / len(val_loader))

    # Plot using tinyGraphs
    tg.plot(train_losses, val_losses, epoch, legend_loc = "upper right", updating_title = False, legend = True, x_label = "x title", y_label = "y title", title = "title", dark_mode = False)

```
## Other Usage Options

```python
    tg.plot(train_losses, val_losses, epoch, legend_loc = "upper right", updating_title = False, legend = True, x_label = "Epoch", y_label = "Loss", title = "Loss Graph", dark_mode = True)
```
![Dark Mode is Awesome!](https://raw.githubusercontent.com/rkdune/tinyGraphs/main/tinyGraphs/images/Dark_Mode_Loss_Graph.png)

```python
    tg.plot(train_losses, val_losses, epoch, color_scheme = 'jet')
```
![Beautiful Loss Graph With Barely Any Code!](https://github.com/rkdune/tinyGraphs/raw/main/tinyGraphs/images/Minimal_Loss_Graph.png)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tinygraphs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "training, plotting, machine-learning, notebook",
    "author": null,
    "author_email": "rkal <rohkal505@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cc/c5/feb21a8d9ee3c331f5e37bf2615817e4d87d9c30e015d6e05f235d01a04a/tinygraphs-1.2.2.tar.gz",
    "platform": null,
    "description": "![](https://github.com/rkdune/tinygraphs/raw/main/tinyGraphs/images/tinygraphs_header.png)\r\n*A minimal library for plotting training progress in Jupyter/COLAB notebooks.*\r\n\r\n## Installation\r\n\r\npip install tinygraphs\r\n\r\n## Options\r\n\r\n`train_losses`: \r\n(Required) List of training loss values to plot\r\n\r\n`val_losses`: \r\n(Required) List of validation loss values to plot\r\n\r\n`epoch`: \r\n(Required) Current epoch number for updating the plot\r\n\r\n`legend_loc`: \r\nLocation of the legend on the plot (default: \"upper right\")\r\n\r\n`updating_title`: \r\nBoolean flag to indicate if the title should update with epoch progress (default: True)\r\n\r\n`legend`: \r\nBoolean flag to show/hide the legend (default: True)\r\n\r\n`x_label`: \r\nLabel for the x-axis\r\n\r\n`y_label`: \r\nLabel for the y-axis\r\n\r\n`title`: \r\nMain title of the plot\r\n\r\n`dark_mode`: \r\nBoolean flag to switch between light and dark themes (default: True)\r\n\r\n## Usage\r\n\r\n```python\r\n\r\nimport tinyGraphs as tg\r\n\r\ntrain_losses, val_losses = [], []\r\nepochs = 3\r\n\r\nfor epoch in range(epochs):\r\n    # Training\r\n    model.train()\r\n    running_train_loss = 0\r\n    for x, y in train_loader:\r\n        x, y = x.to(device), y.to(device)\r\n        optimizer.zero_grad()\r\n        loss = criterion(model(x), y)\r\n        loss.backward()\r\n        optimizer.step()\r\n        running_train_loss += loss.item()\r\n    train_losses.append(running_train_loss / len(train_loader))\r\n\r\n    # Validation\r\n    model.eval()\r\n    running_val_loss = 0\r\n    with torch.no_grad():\r\n        for x, y in val_loader:\r\n            x, y = x.to(device), y.to(device)\r\n            loss = criterion(model(x), y)\r\n            running_val_loss += loss.item()\r\n    val_losses.append(running_val_loss / len(val_loader))\r\n\r\n    # Plot using tinyGraphs\r\n    tg.plot(train_losses, val_losses, epoch, legend_loc = \"upper right\", updating_title = False, legend = True, x_label = \"x title\", y_label = \"y title\", title = \"title\", dark_mode = False)\r\n\r\n```\r\n## Other Usage Options\r\n\r\n```python\r\n    tg.plot(train_losses, val_losses, epoch, legend_loc = \"upper right\", updating_title = False, legend = True, x_label = \"Epoch\", y_label = \"Loss\", title = \"Loss Graph\", dark_mode = True)\r\n```\r\n![Dark Mode is Awesome!](https://raw.githubusercontent.com/rkdune/tinyGraphs/main/tinyGraphs/images/Dark_Mode_Loss_Graph.png)\r\n\r\n```python\r\n    tg.plot(train_losses, val_losses, epoch, color_scheme = 'jet')\r\n```\r\n![Beautiful Loss Graph With Barely Any Code!](https://github.com/rkdune/tinyGraphs/raw/main/tinyGraphs/images/Minimal_Loss_Graph.png)\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 [YOUR NAME]  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A minimal library for plotting training progress in Jupyter/Colab",
    "version": "1.2.2",
    "project_urls": null,
    "split_keywords": [
        "training",
        " plotting",
        " machine-learning",
        " notebook"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4326586e67453e19116c11adb68ac87852c96af38ade7ab97557ef0f0d6cbaed",
                "md5": "f39ec3552f9ec751e9a08e7af6f64bfb",
                "sha256": "25e7adf2b8cc380bcfc01ece912246c62feae61af77dad0a57d569eacbf1fa9b"
            },
            "downloads": -1,
            "filename": "tinygraphs-1.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f39ec3552f9ec751e9a08e7af6f64bfb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5002,
            "upload_time": "2025-01-17T18:10:41",
            "upload_time_iso_8601": "2025-01-17T18:10:41.832116Z",
            "url": "https://files.pythonhosted.org/packages/43/26/586e67453e19116c11adb68ac87852c96af38ade7ab97557ef0f0d6cbaed/tinygraphs-1.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ccc5feb21a8d9ee3c331f5e37bf2615817e4d87d9c30e015d6e05f235d01a04a",
                "md5": "202ec2d3c34738f817f2bb3472ca9b97",
                "sha256": "8805b9a232410582dd99b3f0fe1bb151d2184dc06320dd56b4b61a7cb5923f25"
            },
            "downloads": -1,
            "filename": "tinygraphs-1.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "202ec2d3c34738f817f2bb3472ca9b97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4205,
            "upload_time": "2025-01-17T18:10:46",
            "upload_time_iso_8601": "2025-01-17T18:10:46.050362Z",
            "url": "https://files.pythonhosted.org/packages/cc/c5/feb21a8d9ee3c331f5e37bf2615817e4d87d9c30e015d6e05f235d01a04a/tinygraphs-1.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 18:10:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "tinygraphs"
}
        
Elapsed time: 0.43575s