All Projects → AndreasMadsen → Python Lrcurve

AndreasMadsen / Python Lrcurve

Licence: mit
Creates a learning-curve plot for Jupyter/Colab notebooks that is updated in real-time.

Projects that are alternatives of or similar to Python Lrcurve

Fastbook
The fastai book, published as Jupyter Notebooks
Stars: ✭ 13,998 (+8703.77%)
Mutual labels:  jupyter-notebook
Deep Q Learning
Tensorflow implementation of Deepminds dqn with double dueling networks
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Cfdpython
A sequence of Jupyter notebooks featuring the "12 Steps to Navier-Stokes" http://lorenabarba.com/
Stars: ✭ 2,180 (+1271.07%)
Mutual labels:  jupyter-notebook
Cartoonify
Deploy and scale serverless machine learning app - in 4 steps.
Stars: ✭ 157 (-1.26%)
Mutual labels:  jupyter-notebook
Patch Based Texture Synthesis
Based on "Image Quilting for Texture Synthesis and Transfer" and "Real-Time Texture Synthesis by Patch-Based Sampling" papers
Stars: ✭ 159 (+0%)
Mutual labels:  jupyter-notebook
Tensorflow Dataset Tutorial
Notebook for my medium article about how to use Dataset API in TensorFlow
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Gasyori100knock
image processing codes to understand algorithm
Stars: ✭ 1,988 (+1150.31%)
Mutual labels:  jupyter-notebook
Trl
Train transformer language models with reinforcement learning.
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Handyspark
HandySpark - bringing pandas-like capabilities to Spark dataframes
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Scalable Data Science Platform
Content for architecting a data science platform for products using Luigi, Spark & Flask.
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Covid19 mobility
COVID-19 Mobility Data Aggregator. Scraper of Google, Apple, Waze and TomTom COVID-19 Mobility Reports🚶🚘🚉
Stars: ✭ 156 (-1.89%)
Mutual labels:  jupyter-notebook
Kaggle Environments
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Dss Pytorch
⭐️ PyTorch implement of Deeply Supervised Salient Object Detection with Short Connection
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Notebooks
Stars: ✭ 157 (-1.26%)
Mutual labels:  jupyter-notebook
Hddm
HDDM is a python module that implements Hierarchical Bayesian parameter estimation of Drift Diffusion Models (via PyMC).
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook
Pythonrobotics
Python sample codes for robotics algorithms.
Stars: ✭ 13,934 (+8663.52%)
Mutual labels:  jupyter-notebook
Deepsets
Stars: ✭ 157 (-1.26%)
Mutual labels:  jupyter-notebook
Lecture Python.notebooks
Notebooks for https://python.quantecon.org
Stars: ✭ 159 (+0%)
Mutual labels:  jupyter-notebook
Mixtext
MixText: Linguistically-Informed Interpolation of Hidden Space for Semi-Supervised Text Classification
Stars: ✭ 159 (+0%)
Mutual labels:  jupyter-notebook
House Price Prediction
Predicting house prices using Linear Regression and GBR
Stars: ✭ 158 (-0.63%)
Mutual labels:  jupyter-notebook

lrcurve

Creates a learning-curve plot for Jupyter/Colab notebooks that is updated in real-time.

There is a framework agnostic interface lrcurve.PlotLearningCurve that works well with PyTorch and Tensorflow and a keras wrapper lrcurve.KerasLearningCurve that uses the keras callback interface.

lrcurve works with python 3.6 or newer and is distributed under the MIT license.

Gif of learning-curve

Install

pip install -U lrcurve

API

Examples

Keras example

Open In Colab

from lrcurve import KerasLearningCurve

model.compile(optimizer=keras.optimizers.Adam(),
              loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True),
              metrics=[keras.metrics.SparseCategoricalAccuracy()])

model.fit(train.x, train.y,
          epochs=100,
          verbose=0,
          validation_data=(validation.x, validation.y),
          callbacks=[KerasLearningCurve()])

Gif of learning-curve for keras example

Framework agnostic example

Open In Colab

with PlotLearningCurve() as plot:
    for i in range(100):
        plot.append(i, {
            'loss': math.exp(-(i+1)/10),
            'val_loss': math.exp(-i/10)
        })
        plot.draw()
        time.sleep(0.1)

Gif of learning-curve for simple example

PyTorch example

Open In Colab

from lrcurve import PlotLearningCurve

plot = PlotLearningCurve(
    mappings = {
        'loss': { 'line': 'train', 'facet': 'loss' },
        'val_loss': { 'line': 'validation', 'facet': 'loss' },
        'acc': { 'line': 'train', 'facet': 'acc' },
        'val_acc': { 'line': 'validation', 'facet': 'acc' }
    },
    facet_config = {
        'loss': { 'name': 'Cross-Entropy', 'limit': [0, None], 'scale': 'linear' },
        'acc': { 'name': 'Accuracy', 'limit': [0, 1], 'scale': 'linear' }
    },
    xaxis_config = { 'name': 'Epoch', 'limit': [0, 500] }
)

with plot:
    # optimize model
    for epoch in range(500):
        # compute loss
        z_test = network(x_test)
        loss_test = criterion(z_test, y_test)

        optimizer.zero_grad()
        z_train = network(x_train)
        loss_train = criterion(z_train, y_train)
        loss_train.backward()
        optimizer.step()

        # compute accuacy
        accuacy_test = sklearn.metrics.accuracy_score(torch.argmax(z_test, 1).numpy(), y_test)
        accuacy_train = sklearn.metrics.accuracy_score(torch.argmax(z_train, 1).numpy(), y_train)

        # append and update
        plot.append(epoch, {
            'loss': loss_train,
            'val_loss': loss_test,
            'acc': accuacy_train,
            'val_acc': accuacy_test
        })
        plot.draw()

Gif of learning-curve for pytorch example

Sponsor

Sponsored by NearForm Research.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].