tx · 8Tiq9PrpLGFMXBGGABe7MVibryxyyrcnbvTnKbFxbEWk 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY: -0.01000000 Waves 2024.04.28 14:08 [3082637] smart account 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY > SELF 0.00000000 Waves
{ "type": 13, "id": "8Tiq9PrpLGFMXBGGABe7MVibryxyyrcnbvTnKbFxbEWk", "fee": 1000000, "feeAssetId": null, "timestamp": 1714302541761, "version": 2, "chainId": 84, "sender": "3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY", "senderPublicKey": "2AWdnJuBMzufXSjTvzVcawBQQhnhF1iXR6QNVgwn33oc", "proofs": [ "4wJ6pTXkDpSVRGqGJThxPwgwSkVwvm69FdSu1Z4KZG4TNQWj3EF4idHh3kSP7evTNx8zvt9rcAPbFA4UF7oqrTJP" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAAAkAAAAADWxheWVyMVdlaWdodHMJAARMAAAAAgkABEwAAAACAAAAAAAACSmwCQAETAAAAAIAAAAAAAAJKp0FAAAAA25pbAkABEwAAAACCQAETAAAAAIAAAAAAAAGUfUJAARMAAAAAgAAAAAAAAZSLQUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMUJpYXNlcwkABEwAAAACAP///////AwVCQAETAAAAAIA///////2TQsFAAAAA25pbAAAAAANbGF5ZXIyV2VpZ2h0cwkABEwAAAACCQAETAAAAAIAAAAAAAAMtcYJAARMAAAAAgD///////JPigUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMkJpYXNlcwkABEwAAAACAP//////+i8FBQAAAANuaWwBAAAABmNsYW1wWgAAAAIAAAABegAAAAVsaW1pdAMJAABmAAAAAgUAAAABegUAAAAFbGltaXQFAAAABWxpbWl0AwkAAGYAAAACCQEAAAABLQAAAAEFAAAABWxpbWl0BQAAAAF6CQEAAAABLQAAAAEFAAAABWxpbWl0BQAAAAF6AQAAAApleHBfYXBwcm94AAAAAQAAA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AAgUAAAAMc2NhbGVkSW5wdXQxCQAETAAAAAIFAAAADHNjYWxlZElucHV0MgUAAAADbmlsBAAAAAskdDAyNjQyMjc0MAkBAAAAEWZvcndhcmRQYXNzTGF5ZXIxAAAABAUAAAAGaW5wdXRzBQAAAA1sYXllcjFXZWlnaHRzBQAAAAxsYXllcjFCaWFzZXMCAAAABkxheWVyMQQAAAALZGVidWdMYXllcjEIBQAAAAskdDAyNjQyMjc0MAAAAAJfMQQAAAAMbGF5ZXIxT3V0cHV0CAUAAAALJHQwMjY0MjI3NDAAAAACXzIEAAAACyR0MDI3NDUyODQ5CQEAAAARZm9yd2FyZFBhc3NMYXllcjIAAAAEBQAAAAxsYXllcjFPdXRwdXQFAAAADWxheWVyMldlaWdodHMFAAAADGxheWVyMkJpYXNlcwIAAAAGTGF5ZXIyBAAAAAtkZWJ1Z0xheWVyMggFAAAACyR0MDI3NDUyODQ5AAAAAl8xBAAAAAxsYXllcjJPdXRwdXQIBQAAAAskdDAyNzQ1Mjg0OQAAAAJfMgkABE4AAAACCQAETgAAAAIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAABnJlc3VsdAUAAAAMbGF5ZXIyT3V0cHV0BQAAAANuaWwFAAAAC2RlYnVnTGF5ZXIxBQAAAAtkZWJ1Z0xheWVyMgAAAACK0ZeQ", "height": 3082637, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5K3SesFjoRF1HkRqSncDmVU95ew5cKw5DxSrJdSM3sXu Next: GtG7mCapTmYceaRkKY1vhdnd2yLu3vXtwL6gnTomt2N9 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let layer1Weights = [[600496, 600733], [414197, | |
4 | + | let layer1Weights = [[600496, 600733], [414197, 414253]] | |
5 | 5 | ||
6 | - | let layer1Biases = [- | |
6 | + | let layer1Biases = [-259051, -635637] | |
7 | 7 | ||
8 | - | let layer2Weights = [[ | |
8 | + | let layer2Weights = [[832966, -897142]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
17 | 17 | ||
18 | 18 | ||
19 | 19 | func exp_approx (x) = { | |
20 | - | let maxExp = 100000 | |
21 | - | if ((-(maxExp) > x)) | |
22 | - | then 1 | |
23 | - | else if ((x > maxExp)) | |
24 | - | then 1000000000 | |
25 | - | else { | |
26 | - | let scaled_x = (x / 10000) | |
27 | - | let scaled_x2 = fraction(scaled_x, scaled_x, 10000, DOWN) | |
28 | - | let exp_result = ((10000 - scaled_x) + (scaled_x2 / 2)) | |
29 | - | (10000 - exp_result) | |
30 | - | } | |
20 | + | let abs_x = if ((0 > x)) | |
21 | + | then -(x) | |
22 | + | else x | |
23 | + | let adjusted_x = if ((abs_x > 100000)) | |
24 | + | then 100000 | |
25 | + | else abs_x | |
26 | + | let scaled_x = (adjusted_x / 1000) | |
27 | + | (100000 - (10 * scaled_x)) | |
31 | 28 | } | |
32 | 29 | ||
33 | 30 | ||
34 | 31 | func sigmoid (z,debugPrefix) = { | |
35 | 32 | let clampedZ = clampZ(z, 100000) | |
36 | 33 | let expValue = exp_approx(-(clampedZ)) | |
37 | - | let sigValue = fraction( | |
38 | - | $Tuple2([IntegerEntry((debugPrefix + "clampedZ"), clampedZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
34 | + | let sigValue = fraction(1000000, (1000000 + expValue), 1, DOWN) | |
35 | + | $Tuple2([IntegerEntry((debugPrefix + "inputZ"), z), IntegerEntry((debugPrefix + "clampedZ"), clampedZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
39 | 36 | } | |
40 | 37 | ||
41 | 38 | ||
42 | 39 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
43 | 40 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
44 | 41 | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
45 | - | let $ | |
46 | - | let debugEntries0 = $ | |
47 | - | let sig0 = $ | |
48 | - | let $ | |
49 | - | let debugEntries1 = $ | |
50 | - | let sig1 = $ | |
42 | + | let $t018561909 = sigmoid(sum0, "Layer1N0") | |
43 | + | let debugEntries0 = $t018561909._1 | |
44 | + | let sig0 = $t018561909._2 | |
45 | + | let $t019141967 = sigmoid(sum1, "Layer1N1") | |
46 | + | let debugEntries1 = $t019141967._1 | |
47 | + | let sig1 = $t019141967._2 | |
51 | 48 | let debugInfo = (debugEntries0 ++ debugEntries1) | |
52 | 49 | let output = [sig0, sig1] | |
53 | 50 | $Tuple2(debugInfo, output) | |
56 | 53 | ||
57 | 54 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
58 | 55 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
59 | - | let $ | |
60 | - | let debugEntries0 = $ | |
61 | - | let sig0 = $ | |
56 | + | let $t022772330 = sigmoid(sum0, "Layer2N0") | |
57 | + | let debugEntries0 = $t022772330._1 | |
58 | + | let sig0 = $t022772330._2 | |
62 | 59 | let debugInfo = debugEntries0 | |
63 | 60 | let output = sig0 | |
64 | 61 | $Tuple2(debugInfo, output) | |
74 | 71 | then 1000000 | |
75 | 72 | else 0 | |
76 | 73 | let inputs = [scaledInput1, scaledInput2] | |
77 | - | let $ | |
78 | - | let debugLayer1 = $ | |
79 | - | let layer1Output = $ | |
80 | - | let $ | |
81 | - | let debugLayer2 = $ | |
82 | - | let layer2Output = $ | |
74 | + | let $t026422740 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
75 | + | let debugLayer1 = $t026422740._1 | |
76 | + | let layer1Output = $t026422740._2 | |
77 | + | let $t027452849 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
78 | + | let debugLayer2 = $t027452849._1 | |
79 | + | let layer2Output = $t027452849._2 | |
83 | 80 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
84 | 81 | } | |
85 | 82 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let layer1Weights = [[600496, 600733], [414197, | |
4 | + | let layer1Weights = [[600496, 600733], [414197, 414253]] | |
5 | 5 | ||
6 | - | let layer1Biases = [- | |
6 | + | let layer1Biases = [-259051, -635637] | |
7 | 7 | ||
8 | - | let layer2Weights = [[ | |
8 | + | let layer2Weights = [[832966, -897142]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
12 | 12 | func clampZ (z,limit) = if ((z > limit)) | |
13 | 13 | then limit | |
14 | 14 | else if ((-(limit) > z)) | |
15 | 15 | then -(limit) | |
16 | 16 | else z | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func exp_approx (x) = { | |
20 | - | let maxExp = 100000 | |
21 | - | if ((-(maxExp) > x)) | |
22 | - | then 1 | |
23 | - | else if ((x > maxExp)) | |
24 | - | then 1000000000 | |
25 | - | else { | |
26 | - | let scaled_x = (x / 10000) | |
27 | - | let scaled_x2 = fraction(scaled_x, scaled_x, 10000, DOWN) | |
28 | - | let exp_result = ((10000 - scaled_x) + (scaled_x2 / 2)) | |
29 | - | (10000 - exp_result) | |
30 | - | } | |
20 | + | let abs_x = if ((0 > x)) | |
21 | + | then -(x) | |
22 | + | else x | |
23 | + | let adjusted_x = if ((abs_x > 100000)) | |
24 | + | then 100000 | |
25 | + | else abs_x | |
26 | + | let scaled_x = (adjusted_x / 1000) | |
27 | + | (100000 - (10 * scaled_x)) | |
31 | 28 | } | |
32 | 29 | ||
33 | 30 | ||
34 | 31 | func sigmoid (z,debugPrefix) = { | |
35 | 32 | let clampedZ = clampZ(z, 100000) | |
36 | 33 | let expValue = exp_approx(-(clampedZ)) | |
37 | - | let sigValue = fraction( | |
38 | - | $Tuple2([IntegerEntry((debugPrefix + "clampedZ"), clampedZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
34 | + | let sigValue = fraction(1000000, (1000000 + expValue), 1, DOWN) | |
35 | + | $Tuple2([IntegerEntry((debugPrefix + "inputZ"), z), IntegerEntry((debugPrefix + "clampedZ"), clampedZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
39 | 36 | } | |
40 | 37 | ||
41 | 38 | ||
42 | 39 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
43 | 40 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
44 | 41 | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
45 | - | let $ | |
46 | - | let debugEntries0 = $ | |
47 | - | let sig0 = $ | |
48 | - | let $ | |
49 | - | let debugEntries1 = $ | |
50 | - | let sig1 = $ | |
42 | + | let $t018561909 = sigmoid(sum0, "Layer1N0") | |
43 | + | let debugEntries0 = $t018561909._1 | |
44 | + | let sig0 = $t018561909._2 | |
45 | + | let $t019141967 = sigmoid(sum1, "Layer1N1") | |
46 | + | let debugEntries1 = $t019141967._1 | |
47 | + | let sig1 = $t019141967._2 | |
51 | 48 | let debugInfo = (debugEntries0 ++ debugEntries1) | |
52 | 49 | let output = [sig0, sig1] | |
53 | 50 | $Tuple2(debugInfo, output) | |
54 | 51 | } | |
55 | 52 | ||
56 | 53 | ||
57 | 54 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
58 | 55 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
59 | - | let $ | |
60 | - | let debugEntries0 = $ | |
61 | - | let sig0 = $ | |
56 | + | let $t022772330 = sigmoid(sum0, "Layer2N0") | |
57 | + | let debugEntries0 = $t022772330._1 | |
58 | + | let sig0 = $t022772330._2 | |
62 | 59 | let debugInfo = debugEntries0 | |
63 | 60 | let output = sig0 | |
64 | 61 | $Tuple2(debugInfo, output) | |
65 | 62 | } | |
66 | 63 | ||
67 | 64 | ||
68 | 65 | @Callable(i) | |
69 | 66 | func predict (input1,input2) = { | |
70 | 67 | let scaledInput1 = if ((input1 == 1)) | |
71 | 68 | then 1000000 | |
72 | 69 | else 0 | |
73 | 70 | let scaledInput2 = if ((input2 == 1)) | |
74 | 71 | then 1000000 | |
75 | 72 | else 0 | |
76 | 73 | let inputs = [scaledInput1, scaledInput2] | |
77 | - | let $ | |
78 | - | let debugLayer1 = $ | |
79 | - | let layer1Output = $ | |
80 | - | let $ | |
81 | - | let debugLayer2 = $ | |
82 | - | let layer2Output = $ | |
74 | + | let $t026422740 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
75 | + | let debugLayer1 = $t026422740._1 | |
76 | + | let layer1Output = $t026422740._2 | |
77 | + | let $t027452849 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
78 | + | let debugLayer2 = $t027452849._1 | |
79 | + | let layer2Output = $t027452849._2 | |
83 | 80 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
84 | 81 | } | |
85 | 82 | ||
86 | 83 |
github/deemru/w8io/026f985 34.03 ms ◑