code: Testing

This commit is contained in:
2022-01-07 06:17:37 +01:00
parent 36a45abb82
commit a486e61f9b
2 changed files with 33 additions and 6 deletions

View File

@ -10,18 +10,28 @@ from scipy.stats import laplace
# Initialize plot
lmdk_lib.plot_init()
# The x axis
x = np.arange(0.0, 6.0, 0.01)
plt.xlabel('Count')
x = np.arange(-3, 3.1, .1)
plt.xlabel('Noise')
# Set y axis label
plt.ylabel('Likelihood')
# Draw the first laplace distribution
plt.plot(x,
laplace.pdf(x, loc=2.0, scale=1.0),
label='Laplace(2, 1)',
linewidth=lmdk_lib.line_width)
laplace.pdf(x, loc=0, scale=1/1),
label='Lap(0, 1)',
linewidth=lmdk_lib.line_width*2)
plt.plot(x,
laplace.pdf(x, loc=0, scale=1/.5),
label='Lap(0, 2)',
linewidth=lmdk_lib.line_width*2)
plt.plot(x,
laplace.pdf(x, loc=0, scale=1/.25),
label='Lap(0, 4)',
linewidth=lmdk_lib.line_width*2)
# Configure the plot
plt.axis([0.0, 6.0, 0.0, 0.6]) # Set plot box.
plt.axis([-3, 3, 0.0, 0.6]) # Set plot box.
# Plot legend
lmdk_lib.plot_legend()
# Show the plot in a new window