[go: up one dir, main page]

Jump to content

File:Laplace mechanism.png

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Laplace_mechanism.png (528 × 417 pixels, file size: 22 KB, MIME type: image/png)

Summary

Illustration of the Laplace additive noise mechanism for enforcing w:differential privacy. Created using the following Python code, released by the author into public domain.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import scipy.stats as stats

plt.rc('text', usetex=True)
plt.rc('font', family='serif')

_, ax = plt.subplots()

mu, sigma = 0, 2.

x = np.linspace(mu - 3 * sigma - 1, mu + 3 * sigma + 1, 1000)

d1 = lambda x: stats.laplace.pdf(x, mu, sigma)
d2 = lambda x: stats.laplace.pdf(x, mu + 1, sigma)

ax.plot(x, d1(x), c=colors.CSS4_COLORS['royalblue'], linewidth=4, alpha=.7)
ax.plot(x, d2(x), c=colors.CSS4_COLORS['crimson'], linewidth=4, alpha=.7)

# Hide the right and top spines
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_position(('data', 0))

ax.tick_params(axis='x', length=6, width=1)

plt.xticks(size=16, alpha=.7)

ax.yaxis.set_visible(False)

ax.annotate(r'$\mathrm{Lap}(0,2)$',
            xy=(-1.1, d1(-1)),
            xytext=(-2.5, d1(-1) + .01),
            horizontalalignment='right',
            fontsize=20,
            arrowprops=dict(facecolor='black', alpha=.5, headlength=5, headwidth=5, width=1))

ax.annotate(r'$\mathrm{Lap}(1,2)$',
            xy=(2.1, d2(2)),
            xytext=(4, d2(2) + .01),
            horizontalalignment='left',
            fontsize=20,
            arrowprops=dict(facecolor='black', alpha=.5, headlength=5, headwidth=5, width=1))

# plt.show()
plt.savefig('laplace.png', transparent=True, bbox_inches='tight')

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

copyrighted, dedicated to the public domain by copyright holder<\/a>"}},"text\/plain":{"en":{"P6216":"copyrighted, dedicated to the public domain by copyright holder"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P6216 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">
Creative Commons CC0 License<\/a>"}},"text\/plain":{"en":{"P275":"Creative Commons CC0 License"}}}}" class="wbmi-entityview-statementsGroup wbmi-entityview-statementsGroup-P275 oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-framed">

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current00:37, 19 April 2019Thumbnail for version as of 00:37, 19 April 2019528 × 417 (22 KB)Rc4Color palette adjusted.
23:40, 16 April 2019Thumbnail for version as of 23:40, 16 April 2019528 × 417 (22 KB)Rc4Margins reduced.
23:29, 16 April 2019Thumbnail for version as of 23:29, 16 April 2019640 × 480 (22 KB)Rc4Illustration of the Laplace additive noise mechanism for enforcing differential privacy. Created with matplotlib.

Metadata