In [7]:
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
In [2]:
import numpy as np
np.random.seed(0)
In [3]:
random_values = np.random.rand(100)
r = -4 * random_values
alpha = 10 ** r
In [4]:
plt.scatter(r, alpha);
In [22]:
ranges_alpha = [1e-4, 1e-3, 1e-2, 1e-1, 5e-1, 1]
In [18]:
# There's a very small number of values sampled from 1e-4 to 1e-3 and 1e-3 to 1e-2 ranges (in fact 1 in total)
pd.cut(random_values, ranges_alpha).value_counts()
Out[18]:
In [19]:
# Whereas this sampling allows for more uniform sampling
pd.cut(alpha, ranges_alpha).value_counts()
Out[19]:
In [69]:
random_values_beta = 2 * random_values - 3
beta = 1 - 10 ** random_values_beta
In [70]:
pd.Series(random_values_beta).hist();
In [71]:
plt.scatter(r, beta);
In [72]:
ranges_beta = [0.9, 0.99, 0.999]
In [73]:
pd.cut(beta, ranges_beta).value_counts()
Out[73]: