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

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))

plot(m1)

# 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
plot(m3)

# 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.

Source Distribution

pennpaper-0.15.tar.gz (6.2 kB view hashes)

Uploaded source

Built Distribution

pennpaper-0.15-py3-none-any.whl (9.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page