Bundle Core machine learning types: the seedable Random generator, Matrix2D linear algebra and activations, matrix reference holders, the NeuralNetwork and CSV-backed MatrixReader. Compile with -lib ml.
Random
Deterministic, seedable pseudo-random number generator (MINSTD linear congruential generator). Use this instead of `Float->Random()` when you need reproducible results -- k-means++ seeding, shuffling, and unit tests.
Example
rand := System.ML.Random->New(42);
rand->NextInt(6)->PrintLine(); # reproducible dice roll in [0, 6)
rand->NextReal()->PrintLine(); # value in (0.0, 1.0)Operations
New # constructor
Creates a seeded generator
New(seed:Int)Parameters
| Name | Type | Description |
|---|---|---|
| seed | Int | initial seed (values <= 0 are normalized to a valid state) |
NextInt #
Advances the generator and returns the next raw integer in [1, 2147483646]
method : public : NextInt() ~ IntReturn
| Type | Description |
|---|---|
| Int | pseudo-random integer |
NextInt #
Returns a non-negative integer less than bound
method : public : NextInt(bound:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| bound | Int | exclusive upper bound (must be > 0) |
Return
| Type | Description |
|---|---|
| Int | value in [0, bound) |