Skip to main content

Set of utilities for ploting results of non-deterministic experiments, e.g. machine learning, optimization, genetic algorithms.

Project description


Pen'n'paper is a package to easily collect the data about (noisy) processes and plot them for comparison. This package is not aiming at feature completeness. Instead it should give you an easy start during the phase of the project when you want to just concentrate on an experimental idea.

Installation: pip install pennpaper

By example:

# We have a mysterious function that we would like to better understand on the interval [0.1, 5.].
# Unfortunately the function is noisy.

import numpy as np

X = np.arange(0.1, 5, step=0.01)

import random

def noisy_mapping(mapping):
    def _(x):
        y = mapping(x)
        y += random.gauss(0, 1)
        return y

    return _

pow2 = noisy_mapping(lambda x: x ** 2)

# lets record the pairs (x, f(x)) in a metric and make a plot:
from pennpaper import Metric, plot_group, plot

m1 = Metric("pow2")
for x in X:
    m1.add_record(x, pow2(x))


# try again - see in how far it repeats itself.
m2 = Metric("pow2_second_try")
for x in X:
    m2.add_record(x, pow2(x))

# lets plot two metrics side-by-side
plot_group([m1, m2])

# Actually, m1 and m2 are metrics of the same process. 
# What if we create a new metric tracking the mean and stddev of this process?
m3 = m1 + m2

# the plot is too noisy to understand. We can smoothen it!
plot(m3, smoothen=True)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pennpaper, version 0.15
Filename, size File type Python version Upload date Hashes
Filename, size pennpaper-0.15-py3-none-any.whl (9.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pennpaper-0.15.tar.gz (6.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page