2 , 3 , 4 , 5 } { S e r v e r w o r k s ( ' T o k y o ' ) , S e r v e r w o r k s ( ' O s a k a ' ) , S e r v e r w o r k s ( ' F u k u o k a ' ) } / / J a v a S c r i p t [ 1 , 2 , 3 , 4 , 5 ] ; [ n e w S e r v e r w o r k s ( ' T o k y o ' ) , n e w S e r v e r w o r k s ( ' O s a k a ' ) , n e w S e r v e r w o r k s ( ' F u k u o k a ' ) ] ; / / E S 6 n e w S e t ( [ 1 , 2 , 3 , 4 , 5 ] ) ; 46
n x = [ 1 , 2 , 3 ] t o t a l = 0 ; i = 0 ; w h i l e i < = l e n ( x ) ‑ 1 : t o t a l = t o t a l + x [ i ] i = i + 1 ; / / j a v a s c r i p t c o n s t x = [ 1 , 2 , 3 ] l e t t o t a l = 0 f o r ( l e t i = 0 ; i < = i . l e n g t h ‑ 1 ; i + + ) { t o t a l = t o t a l + x [ i ] } i=0 ∑ n−1 i 52
= { 1 , 2 , 3 } s u m ( x ) r e d u c e ( l a m b d a a , b : a + b , x ) t o t a l = 0 f o r e i n x t o t a l = t o t a l + e / / j s c o n s t x = [ 1 , 2 , 3 ] x . r e d u c e ( ( p r e v , c u r r e n t ) = > p r e v + c u r r e n t ) ∑ 53
+ ⋯ + b evidence = W x + W x + W x + ⋯ + b evidence = W x + W x + W x + ⋯ + b evidence = W x + W x + W x + ⋯ + b ⋮ 1 1, 1 1 1, 2 2 1, 3 3 1 2 2, 1 1 2, 2 2 2, 3 3 2 3 3, 1 1 3, 2 2 3, 3 3 3 4 4, 1 1 4, 2 2 4, 3 3 4 56
+ ⋯ + b evidence = W x + W x + W x + ⋯ + b evidence = W x + W x + W x + ⋯ + b evidence = W x + W x + W x + ⋯ + b ⋮ 1 1, 1 1 1, 2 2 1, 3 3 1 2 2, 1 1 2, 2 2 2, 3 3 2 3 3, 1 1 3, 2 2 3, 3 3 3 4 4, 1 1 4, 2 2 4, 3 3 4 59
( [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] , [ 7 , 8 , 9 ] ] ) a = n p . a r r a y ( [ [ 1 ] , [ 2 ] , [ 3 ] ] ) / / 行列の積を求める n p . d o t ( M , a ) / / a r r a y ( [ [ 1 4 ] , [ 3 2 ] , [ 5 0 ] ] ) ふたつの変数のかけ算で表せる。 70
+ ⋯ + b evidence = W x + W x + W x + ⋯ + b evidence = W x + W x + W x + ⋯ + b evidence = W x + W x + W x + ⋯ + b ⋮ 1 1, 1 1 1, 2 2 1, 3 3 1 2 2, 1 1 2, 2 2 2, 3 3 2 3 3, 1 1 3, 2 2 3, 3 3 3 4 4, 1 1 4, 2 2 4, 3 3 4 71