code: Testing
This commit is contained in:
parent
36a45abb82
commit
a486e61f9b
@ -1072,3 +1072,20 @@ def is_landmark(p, lmdks):
|
|||||||
if len(lmdks) > 0 and any(np.equal(lmdks, p).all(1)):
|
if len(lmdks) > 0 and any(np.equal(lmdks, p).all(1)):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
seq = [1, 2, 3, 4, 5, 6, 7, 8]
|
||||||
|
lmdk = [1, 3, 5, 8]
|
||||||
|
print(get_hist(seq, lmdk))
|
||||||
|
start_time = time.process_time()
|
||||||
|
# main(args)
|
||||||
|
end_time = time.process_time()
|
||||||
|
print('##############################\n'
|
||||||
|
'Time : %.4fs\n'
|
||||||
|
'##############################\n'
|
||||||
|
%(end_time - start_time), flush=True)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('Interrupted by user.')
|
||||||
|
exit()
|
||||||
|
@ -10,18 +10,28 @@ from scipy.stats import laplace
|
|||||||
# Initialize plot
|
# Initialize plot
|
||||||
lmdk_lib.plot_init()
|
lmdk_lib.plot_init()
|
||||||
# The x axis
|
# The x axis
|
||||||
x = np.arange(0.0, 6.0, 0.01)
|
x = np.arange(-3, 3.1, .1)
|
||||||
plt.xlabel('Count')
|
plt.xlabel('Noise')
|
||||||
# Set y axis label
|
# Set y axis label
|
||||||
plt.ylabel('Likelihood')
|
plt.ylabel('Likelihood')
|
||||||
# Draw the first laplace distribution
|
# Draw the first laplace distribution
|
||||||
plt.plot(x,
|
plt.plot(x,
|
||||||
laplace.pdf(x, loc=2.0, scale=1.0),
|
laplace.pdf(x, loc=0, scale=1/1),
|
||||||
label='Laplace(2, 1)',
|
label='Lap(0, 1)',
|
||||||
linewidth=lmdk_lib.line_width)
|
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
|
# 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
|
# Plot legend
|
||||||
lmdk_lib.plot_legend()
|
lmdk_lib.plot_legend()
|
||||||
# Show the plot in a new window
|
# Show the plot in a new window
|
||||||
|
Loading…
Reference in New Issue
Block a user