Return a random matrix with data from the "standard normal" distribution. `randn` generates a matrix filled with random floats sampled from a univariate "normal" (Gaussian) distribution of mean 0 and variance 1. Parameters ---------- \\*args : Arguments Shape of th
(*args)
| 277 | return asmatrix(np.random.rand(*args)) |
| 278 | |
| 279 | def randn(*args): |
| 280 | """ |
| 281 | Return a random matrix with data from the "standard normal" distribution. |
| 282 | |
| 283 | `randn` generates a matrix filled with random floats sampled from a |
| 284 | univariate "normal" (Gaussian) distribution of mean 0 and variance 1. |
| 285 | |
| 286 | Parameters |
| 287 | ---------- |
| 288 | \\*args : Arguments |
| 289 | Shape of the output. |
| 290 | If given as N integers, each integer specifies the size of one |
| 291 | dimension. If given as a tuple, this tuple gives the complete shape. |
| 292 | |
| 293 | Returns |
| 294 | ------- |
| 295 | Z : matrix of floats |
| 296 | A matrix of floating-point samples drawn from the standard normal |
| 297 | distribution. |
| 298 | |
| 299 | See Also |
| 300 | -------- |
| 301 | rand, numpy.random.RandomState.randn |
| 302 | |
| 303 | Notes |
| 304 | ----- |
| 305 | For random samples from the normal distribution with mean ``mu`` and |
| 306 | standard deviation ``sigma``, use:: |
| 307 | |
| 308 | sigma * np.matlib.randn(...) + mu |
| 309 | |
| 310 | Examples |
| 311 | -------- |
| 312 | >>> np.random.seed(123) |
| 313 | >>> import numpy.matlib |
| 314 | >>> np.matlib.randn(1) |
| 315 | matrix([[-1.0856306]]) |
| 316 | >>> np.matlib.randn(1, 2, 3) |
| 317 | matrix([[ 0.99734545, 0.2829785 , -1.50629471], |
| 318 | [-0.57860025, 1.65143654, -2.42667924]]) |
| 319 | |
| 320 | Two-by-four matrix of samples from the normal distribution with |
| 321 | mean 3 and standard deviation 2.5: |
| 322 | |
| 323 | >>> 2.5 * np.matlib.randn((2, 4)) + 3 |
| 324 | matrix([[1.92771843, 6.16484065, 0.83314899, 1.30278462], |
| 325 | [2.76322758, 6.72847407, 1.40274501, 1.8900451 ]]) |
| 326 | |
| 327 | """ |
| 328 | if isinstance(args[0], tuple): |
| 329 | args = args[0] |
| 330 | return asmatrix(np.random.randn(*args)) |
| 331 | |
| 332 | def repmat(a, m, n): |
| 333 | """ |
searching dependent graphs…