%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd

import numpy as np
np.random.seed(0)

"""
Explanation: Hyperparameter Scaling
End of explanation
"""


random_values = np.random.rand(100)
r = -4 * random_values
alpha = 10 ** r

plt.scatter(r, alpha);

ranges_alpha = [1e-4, 1e-3, 1e-2, 1e-1, 5e-1, 1]

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

# Whereas this sampling allows for more uniform sampling
pd.cut(alpha, ranges_alpha).value_counts()

"""
Explanation: Learning Rate $ \alpha $
Pick values between 0 and 1
Problem is that 1e-4 to 1e-3 regions, 1e-3 to 1e-2, 1e-2 to 1e-1 regions are not equally represented.
End of explanation
"""


random_values_beta = 2 * random_values - 3
beta = 1 - 10 ** random_values_beta

pd.Series(random_values_beta).hist();

plt.scatter(r, beta);

ranges_beta = [0.9, 0.99, 0.999]

pd.cut(beta, ranges_beta).value_counts()

"""
Explanation: Beta $\beta$
Ranging between 0.9 and 0.999
End of explanation
"""


