MCPcopy
hub / github.com/ddbourgin/numpy-ml / random_stochastic_matrix

Function random_stochastic_matrix

numpy_ml/utils/testing.py:70–74  ·  view source on GitHub ↗

Create a random stochastic matrix of shape (`n_examples`, `n_classes`)

(n_examples, n_classes)

Source from the content-addressed store, hash-verified

68
69
70def 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
77def random_tensor(shape, standardize=False):

Callers 9

test_cross_entropyFunction · 0.90
test_softmax_activationFunction · 0.90
test_relu_activationFunction · 0.90
test_softplus_activationFunction · 0.90
test_softplus_activationFunction · 0.90
test_relu_activationFunction · 0.90
test_selu_activationFunction · 0.90
test_gelu_activationFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected