MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / random_binary_tensor

Function random_binary_tensor

numpy_ml/plots/lm_plots.py:33–35  ·  view source on GitHub ↗
(shape, sparsity=0.5)

Source from the content-addressed store, hash-verified

31
32
33def random_binary_tensor(shape, sparsity=0.5):
34 X = (np.random.rand(*shape) >= (1 - sparsity)).astype(float)
35 return X
36
37
38def random_regression_problem(n_ex, n_in, n_out, intercept=0, std=1, seed=0):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected