跳转到主要内容

一套用于绘制非确定性实验(例如机器学习、优化、遗传算法)结果的实用工具。

项目描述

Pen'n'paper

Pen'n'paper是一个易于收集(有噪声)过程数据并将其进行比较的软件包。此软件包的目标不是功能完整性。相反,它应该让您在项目阶段轻松开始,当时您只想专注于实验想法。

安装:pip install pennpaper

示例

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

项目详情


下载文件

下载适用于您平台的应用程序。如果您不确定要选择哪个,请了解更多关于安装包的信息。

源代码分布

pennpaper-0.15.tar.gz (6.2 kB 查看哈希值)

上传时间: 源代码

构建分布

pennpaper-0.15-py3-none-any.whl (9.1 kB 查看哈希值)

上传时间: Python 3

由以下组织支持