tx · 2b25PWcsfJJqtzYdx5PHEx5557PpxguKVWbbsMW8ffgA 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY: -0.01000000 Waves 2024.04.28 12:59 [3082559] smart account 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY > SELF 0.00000000 Waves
{ "type": 13, "id": "2b25PWcsfJJqtzYdx5PHEx5557PpxguKVWbbsMW8ffgA", "fee": 1000000, "feeAssetId": null, "timestamp": 1714298417301, "version": 2, "chainId": 84, "sender": "3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY", "senderPublicKey": "2AWdnJuBMzufXSjTvzVcawBQQhnhF1iXR6QNVgwn33oc", "proofs": [ "ytP45QFEDTrqFyfLANC1rSgWhF5bLrBzSacJxfDsz42hh5A7wbPWW4jgcF8QDdm54LH2BUTH2QUcMHnVKB6kc4m" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAAAcAAAAADWxheWVyMVdlaWdodHMJAARMAAAAAgkABEwAAAACAAAAAAAACSmwCQAETAAAAAIAAAAAAAAJKp0FAAAAA25pbAkABEwAAAACCQAETAAAAAIAAAAAAAAGUfQJAARMAAAAAgAAAAAAAAZSLQUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMUJpYXNlcwkABEwAAAACAP///////AwVCQAETAAAAAIA///////2TQsFAAAAA25pbAAAAAANbGF5ZXIyV2VpZ2h0cwkABEwAAAACCQAETAAAAAIAAAAAAAAMtcUJAARMAAAAAgD///////JPigUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMkJpYXNlcwkABEwAAAACAP//////+i8FBQAAAANuaWwBAAAAB3NpZ21vaWQAAAACAAAAAXoAAAALZGVidWdQcmVmaXgEAAAAAWUAAAAAAAApekkEAAAABGJhc2UAAAAAAAAPQkAEAAAACXBvc2l0aXZlWgMJAABmAAAAAgAAAAAAAAAAAAUAAAABegkBAAAAAS0AAAABBQAAAAF6BQAAAAF6BAAAAAdzY2FsZWRaCQAAaQAAAAIF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AUAAAALJHQwMjAyODIxMzIAAAACXzEEAAAADGxheWVyMk91dHB1dAgFAAAACyR0MDIwMjgyMTMyAAAAAl8yCQAETgAAAAIJAAROAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAGcmVzdWx0BQAAAAxsYXllcjJPdXRwdXQFAAAAA25pbAUAAAALZGVidWdMYXllcjEFAAAAC2RlYnVnTGF5ZXIyAAAAAN7D/2o=", "height": 3082559, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EagziTUuatBGN4yrywpoprrknF46urgJ1q46iavxr1Ng Next: 7s1h3jYoYnAwi8pPGmy5HUUL4Ybuoz6K6kVB7GwRyRrV Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let layer1Weights = [[ | |
4 | + | let layer1Weights = [[600496, 600733], [414196, 414253]] | |
5 | 5 | ||
6 | 6 | let layer1Biases = [-259051, -635637] | |
7 | 7 | ||
8 | 8 | let layer2Weights = [[832965, -897142]] | |
9 | 9 | ||
10 | - | let layer2Biases = [-381178] | |
11 | - | ||
12 | - | func exp_approx (x) = { | |
13 | - | let scale = 100000 | |
14 | - | if (((-6 * scale) > x)) | |
15 | - | then 1 | |
16 | - | else if ((x > (6 * scale))) | |
17 | - | then 99999 | |
18 | - | else { | |
19 | - | let coefficients = [$Tuple2(60000, 99999), $Tuple2(50000, 95000), $Tuple2(40000, 90000), $Tuple2(30000, 85000), $Tuple2(20000, 80000), $Tuple2(10000, 75000), $Tuple2(0, 70000), $Tuple2(-10000, 65000), $Tuple2(-20000, 60000), $Tuple2(-30000, 55000), $Tuple2(-40000, 50000), $Tuple2(-50000, 45000), $Tuple2(-60000, 40000)] | |
20 | - | let index = ((x + 60000) / 10000) | |
21 | - | let $t0920957 = coefficients[index] | |
22 | - | let blabla = $t0920957._1 | |
23 | - | let y = $t0920957._2 | |
24 | - | y | |
25 | - | } | |
26 | - | } | |
27 | - | ||
10 | + | let layer2Biases = [-381179] | |
28 | 11 | ||
29 | 12 | func sigmoid (z,debugPrefix) = { | |
30 | - | let base = 100000 | |
13 | + | let e = 2718281 | |
14 | + | let base = 1000000 | |
31 | 15 | let positiveZ = if ((0 > z)) | |
32 | 16 | then -(z) | |
33 | 17 | else z | |
34 | - | let expValue = exp_approx(positiveZ) | |
35 | - | let sigValue = ((base * expValue) / (base + expValue)) | |
36 | - | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
18 | + | let scaledZ = (positiveZ / 10000) | |
19 | + | let expPart = fraction(e, base, scaledZ) | |
20 | + | let sigValue = fraction(base, (base + expPart), base) | |
21 | + | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expPart"), expPart), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
37 | 22 | } | |
38 | 23 | ||
39 | 24 | ||
40 | 25 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
41 | 26 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
42 | 27 | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
43 | - | let $ | |
44 | - | let debugEntries0 = $ | |
45 | - | let sig0 = $ | |
46 | - | let $ | |
47 | - | let debugEntries1 = $ | |
48 | - | let sig1 = $ | |
28 | + | let $t011391192 = sigmoid(sum0, "Layer1N0") | |
29 | + | let debugEntries0 = $t011391192._1 | |
30 | + | let sig0 = $t011391192._2 | |
31 | + | let $t011971250 = sigmoid(sum1, "Layer1N1") | |
32 | + | let debugEntries1 = $t011971250._1 | |
33 | + | let sig1 = $t011971250._2 | |
49 | 34 | let debugInfo = (debugEntries0 ++ debugEntries1) | |
50 | 35 | let output = [sig0, sig1] | |
51 | 36 | $Tuple2(debugInfo, output) | |
54 | 39 | ||
55 | 40 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
56 | 41 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
57 | - | let $ | |
58 | - | let debugEntries0 = $ | |
59 | - | let sig0 = $ | |
42 | + | let $t015601613 = sigmoid(sum0, "Layer2N0") | |
43 | + | let debugEntries0 = $t015601613._1 | |
44 | + | let sig0 = $t015601613._2 | |
60 | 45 | let debugInfo = debugEntries0 | |
61 | 46 | let output = sig0 | |
62 | 47 | $Tuple2(debugInfo, output) | |
72 | 57 | then 1000000 | |
73 | 58 | else 0 | |
74 | 59 | let inputs = [scaledInput1, scaledInput2] | |
75 | - | let $ | |
76 | - | let debugLayer1 = $ | |
77 | - | let layer1Output = $ | |
78 | - | let $ | |
79 | - | let debugLayer2 = $ | |
80 | - | let layer2Output = $ | |
60 | + | let $t019252023 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
61 | + | let debugLayer1 = $t019252023._1 | |
62 | + | let layer1Output = $t019252023._2 | |
63 | + | let $t020282132 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
64 | + | let debugLayer2 = $t020282132._1 | |
65 | + | let layer2Output = $t020282132._2 | |
81 | 66 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
82 | 67 | } | |
83 | 68 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let layer1Weights = [[ | |
4 | + | let layer1Weights = [[600496, 600733], [414196, 414253]] | |
5 | 5 | ||
6 | 6 | let layer1Biases = [-259051, -635637] | |
7 | 7 | ||
8 | 8 | let layer2Weights = [[832965, -897142]] | |
9 | 9 | ||
10 | - | let layer2Biases = [-381178] | |
11 | - | ||
12 | - | func exp_approx (x) = { | |
13 | - | let scale = 100000 | |
14 | - | if (((-6 * scale) > x)) | |
15 | - | then 1 | |
16 | - | else if ((x > (6 * scale))) | |
17 | - | then 99999 | |
18 | - | else { | |
19 | - | let coefficients = [$Tuple2(60000, 99999), $Tuple2(50000, 95000), $Tuple2(40000, 90000), $Tuple2(30000, 85000), $Tuple2(20000, 80000), $Tuple2(10000, 75000), $Tuple2(0, 70000), $Tuple2(-10000, 65000), $Tuple2(-20000, 60000), $Tuple2(-30000, 55000), $Tuple2(-40000, 50000), $Tuple2(-50000, 45000), $Tuple2(-60000, 40000)] | |
20 | - | let index = ((x + 60000) / 10000) | |
21 | - | let $t0920957 = coefficients[index] | |
22 | - | let blabla = $t0920957._1 | |
23 | - | let y = $t0920957._2 | |
24 | - | y | |
25 | - | } | |
26 | - | } | |
27 | - | ||
10 | + | let layer2Biases = [-381179] | |
28 | 11 | ||
29 | 12 | func sigmoid (z,debugPrefix) = { | |
30 | - | let base = 100000 | |
13 | + | let e = 2718281 | |
14 | + | let base = 1000000 | |
31 | 15 | let positiveZ = if ((0 > z)) | |
32 | 16 | then -(z) | |
33 | 17 | else z | |
34 | - | let expValue = exp_approx(positiveZ) | |
35 | - | let sigValue = ((base * expValue) / (base + expValue)) | |
36 | - | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
18 | + | let scaledZ = (positiveZ / 10000) | |
19 | + | let expPart = fraction(e, base, scaledZ) | |
20 | + | let sigValue = fraction(base, (base + expPart), base) | |
21 | + | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expPart"), expPart), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
37 | 22 | } | |
38 | 23 | ||
39 | 24 | ||
40 | 25 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
41 | 26 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
42 | 27 | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
43 | - | let $ | |
44 | - | let debugEntries0 = $ | |
45 | - | let sig0 = $ | |
46 | - | let $ | |
47 | - | let debugEntries1 = $ | |
48 | - | let sig1 = $ | |
28 | + | let $t011391192 = sigmoid(sum0, "Layer1N0") | |
29 | + | let debugEntries0 = $t011391192._1 | |
30 | + | let sig0 = $t011391192._2 | |
31 | + | let $t011971250 = sigmoid(sum1, "Layer1N1") | |
32 | + | let debugEntries1 = $t011971250._1 | |
33 | + | let sig1 = $t011971250._2 | |
49 | 34 | let debugInfo = (debugEntries0 ++ debugEntries1) | |
50 | 35 | let output = [sig0, sig1] | |
51 | 36 | $Tuple2(debugInfo, output) | |
52 | 37 | } | |
53 | 38 | ||
54 | 39 | ||
55 | 40 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
56 | 41 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
57 | - | let $ | |
58 | - | let debugEntries0 = $ | |
59 | - | let sig0 = $ | |
42 | + | let $t015601613 = sigmoid(sum0, "Layer2N0") | |
43 | + | let debugEntries0 = $t015601613._1 | |
44 | + | let sig0 = $t015601613._2 | |
60 | 45 | let debugInfo = debugEntries0 | |
61 | 46 | let output = sig0 | |
62 | 47 | $Tuple2(debugInfo, output) | |
63 | 48 | } | |
64 | 49 | ||
65 | 50 | ||
66 | 51 | @Callable(i) | |
67 | 52 | func predict (input1,input2) = { | |
68 | 53 | let scaledInput1 = if ((input1 == 1)) | |
69 | 54 | then 1000000 | |
70 | 55 | else 0 | |
71 | 56 | let scaledInput2 = if ((input2 == 1)) | |
72 | 57 | then 1000000 | |
73 | 58 | else 0 | |
74 | 59 | let inputs = [scaledInput1, scaledInput2] | |
75 | - | let $ | |
76 | - | let debugLayer1 = $ | |
77 | - | let layer1Output = $ | |
78 | - | let $ | |
79 | - | let debugLayer2 = $ | |
80 | - | let layer2Output = $ | |
60 | + | let $t019252023 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
61 | + | let debugLayer1 = $t019252023._1 | |
62 | + | let layer1Output = $t019252023._2 | |
63 | + | let $t020282132 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
64 | + | let debugLayer2 = $t020282132._1 | |
65 | + | let layer2Output = $t020282132._2 | |
81 | 66 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
82 | 67 | } | |
83 | 68 | ||
84 | 69 |
github/deemru/w8io/169f3d6 31.90 ms ◑