-
-
Save gbushnell/142acb9c82b15b57616fbbd9470250df to your computer and use it in GitHub Desktop.
Observed Frequencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute observed probability matrix | |
observed_prob_matrix = np.zeros((10, 2)) | |
data_cols_length = [data.first_digit.count(), data[data.second_digit != 'NaN'].second_digit.count()] | |
for d_i in range(observed_prob_matrix.shape[0]): | |
for n_i in range(observed_prob_matrix.shape[1]): | |
observed_prob_matrix[d_i, n_i] = data[data.iloc[:, n_i + 2] == d_i].iloc[:, n_i + 2].count() / \ | |
data_cols_length[n_i] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment