Create a random stochastic matrix of shape (`n_examples`, `n_classes`)
(n_examples, n_classes)
| 68 | |
| 69 | |
| 70 | def random_stochastic_matrix(n_examples, n_classes): |
| 71 | """Create a random stochastic matrix of shape (`n_examples`, `n_classes`)""" |
| 72 | X = np.random.rand(n_examples, n_classes) |
| 73 | X /= X.sum(axis=1, keepdims=True) |
| 74 | return X |
| 75 | |
| 76 | |
| 77 | def random_tensor(shape, standardize=False): |
no outgoing calls
no test coverage detected