How to use the random function from mathjs
Find comprehensive JavaScript mathjs.random code examples handpicked from public code repositorys.
GitHub: coder0987/Taroky
3594 3595 3596 3597 3598 3599 3600 3601 3602 3603
this.layersWeights = [20,1000,1000]; this.layersBias = [20,1000]; this.outputWeights = [14,1000]; this.outputBias = [14]; this.inputWeights = math.random(math.matrix([this.inputWeightsSize[0], this.inputWeightsSize[1]])); // 2k x 1k this.layersWeights = math.random(math.matrix([this.layersWeights[0], this.layersWeights[1], this.layersWeights[2]])); // 20 x 1k x 1k this.layersBias = math.random(math.matrix([this.layersBias[0], this.layersBias[1]])); // 20 x 1k x 1 this.outputWeights = math.random(math.matrix([this.outputWeights[1], this.outputWeights[0]])); // 14 x 1k this.outputBias = math.random(math.matrix([this.outputBias[0]])); // 14 x 1
1
2
2
+ 14 other calls in file
GitHub: brin-eris/basic-bots
33 34 35 36 37 38 39 40 41 42
value+= 10*(Math.random()-0.5); } return value; }); this.hiddenLayerBiasA = Mathjs.random([this.inputSize],-0.01, 0.01).map( function(value, index, matrix) { if(Math.random() < 0.2){ value+= 10*(Math.random()-0.5); } return value;
0
1
1
+ 47 other calls in file
GitHub: xiefengnian/js-ml
126 127 128 129 130 131 132 133 134 135
}); }; const init_parameters_w = function (layer) { const dist = distribution[layer]['w']; return Matrix.rand(dimension[layer - 1], dimension[layer], { random: () => math.random() * (dist[1] - dist[0]) + dist[0], }); }; const init_parameters = function () {
1
0
0
+ 3 other calls in file
14 15 16 17 18 19 20 21 22 23
* x(t+1) = x(t) + ø * (x(t) - randx) */ explore() { if (this.trial <= config.abc.max_trials) { let component = mathjs.pickRandom(this.position); let phi = mathjs.random([1, dimensions], -1, 1)[0]; let sub = mathjs.subtract(this.position, component); let mul = mathjs.dotMultiply(sub, phi); let new_position = mathjs.add(this.position, mul);
0
0
0
59 60 61 62 63 64 65 66 67
* @returns {*} */ individual_movement(school, step, boundaries) { school.forEach((fish) => { let rand = mathjs.random([1, dimensions], -1, 1)[0]; let factor = mathjs.dotMultiply(rand, step); let nextPosition = mathjs.add(fish.position, factor);
0
0
0
+ 7 other calls in file
GitHub: Kirigaya-Kazuton/IA
55 56 57 58 59 60 61 62 63 64
// subtração 5 - 2 e 3 -1 console.log('subtração:', math.subtract([5, 3], [2, 1])); // transposição [1, 3], [2, 4] console.log('transposição:', math.transpose([[1, 2], [3, 4]])); // seleção aleatória console.log('seleção aleatória:', math.random([2, 2])); // adição 3, 5 console.log('adição:', math.add([1, 2], [2, 3])); // divisão 5, 4 console.log('divisão:', math.dotDivide([10, 12], [2, 3]));
0
0
0
+ 2 other calls in file
GitHub: OrghoN/hillCipher
24 25 26 27 28 29 30 31 32 33 34
function createEncodingKey(n, max) { var det = 0; var encodingKey while (det === 0) { encodingKey = math.random([n, n], 1, max); encodingKey = math.map(encodingKey, function(val) { return math.round(val); }); det = math.det(encodingKey);
0
0
0
GitHub: rbren/axon
26 27 28 29 30 31 32 33 34 35
input: [], output: [], }, subscribers: [], hidden: M.zeros(dim.hidden), bias: M.random([dim.hidden], -1, 1), transforms: {}, }; this.log('CREATED', this.options); }
0
0
2
+ 7 other calls in file
mathjs.evaluate is the most popular function in mathjs (87200 examples)