def compute_probs(data, alpha):
    if (data.dtype != np.float32):
        data = data.astype(np.float32)
    n_features = data.shape[1]
    n_samples = data.shape[0]
    j_ones = np.dot(data.T, data)
    j_ones = j_ones.astype(np.float64)
    j_ones_diag = np.diag(j_ones)
    cols_diag = (j_ones_diag * np.ones((n_features, n_features)))
    rows_diag = cols_diag.transpose()
    probs = np.zeros((n_features, 2))
    j_probs = np.zeros((n_features, n_features, 2, 2))
    probs[:, 1] = ((j_ones_diag + (2 * alpha)) / (n_samples + (4 * alpha)))
    probs[:, 0] = (1 - probs[:, 1])
    j_probs[:, :, 0, 0] = ((((n_samples - cols_diag) - rows_diag) + j_ones) + alpha)
    j_probs[:, :, 0, 1] = ((cols_diag - j_ones) + alpha)
    j_probs[:, :, 1, 0] = ((rows_diag - j_ones) + alpha)
    j_probs[:, :, 1, 1] = (j_ones + alpha)
    j_probs = (j_probs / (n_samples + (4 * alpha)))
    return (probs, j_probs)
def compute_probs(data, alpha):
    if (data.dtype != np.float32):
        data = data.astype(np.float32)
    n_features = data.shape[1]
    n_samples = data.shape[0]
    j_ones = np.dot(data.T, data)
    j_ones = j_ones.astype(np.float64)
    j_ones_diag = np.diag(j_ones)
    cols_diag = (j_ones_diag * np.ones((n_features, n_features)))
    rows_diag = cols_diag.transpose()
    probs = np.zeros((n_features, 2))
    j_probs = np.zeros((n_features, n_features, 2, 2))
    probs[:, 1] = ((j_ones_diag + (2 * alpha)) / (n_samples + (4 * alpha)))
    probs[:, 0] = (1 - probs[:, 1])
    j_probs[:, :, 0, 0] = ((((n_samples - cols_diag) - rows_diag) + j_ones) + alpha)
    j_probs[:, :, 0, 1] = ((cols_diag - j_ones) + alpha)
    j_probs[:, :, 1, 0] = ((rows_diag - j_ones) + alpha)
    j_probs[:, :, 1, 1] = (j_ones + alpha)
    j_probs = (j_probs / (n_samples + (4 * alpha)))
    return (probs, j_probs)