tx · 8cdRbGHsNfmgK7NCToFRuLF7cqYNwNiYjBcET9w8VCPR 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY: -0.01000000 Waves 2024.04.28 11:17 [3082456] smart account 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY > SELF 0.00000000 Waves
{ "type": 13, "id": "8cdRbGHsNfmgK7NCToFRuLF7cqYNwNiYjBcET9w8VCPR", "fee": 1000000, "feeAssetId": null, "timestamp": 1714292244171, "version": 2, "chainId": 84, "sender": "3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY", "senderPublicKey": "2AWdnJuBMzufXSjTvzVcawBQQhnhF1iXR6QNVgwn33oc", "proofs": [ "4ckzcv7MqGWpU4esUzqCZnSpaZcN9pAuNma3r1921zntamA1e5t86rdALtzW85PzytyRnX2RY3fYLz1mt9gwuP5g" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAAAgAAAAADWxheWVyMVdlaWdodHMJAARMAAAAAgkABEwAAAACAAAAAAAACSmwCQAETAAAAAIAAAAAAAAJKp0FAAAAA25pbAkABEwAAAACCQAETAAAAAIAAAAAAAAGUfQJAARMAAAAAgAAAAAAAAZSLQUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMUJpYXNlcwkABEwAAAACAP///////AwWCQAETAAAAAIA///////2TQsFAAAAA25pbAAAAAANbGF5ZXIyV2VpZ2h0cwkABEwAAAACCQAETAAAAAIAAAAAAAAMtcUJAARMAAAAAgD///////JPigUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMkJpYXNlcwkABEwAAAACAP//////+i8FBQAAAANuaWwBAAAAEWV4cF9hcHByb3hpbWF0aW9uAAAAAQAAAAF4BAAAAAFlCQABNgAAAAEAAAAAAAApekkEAAAAB2ZhY3RvcjEFAAAAAXgEAAAAB2ZhY3RvcjIJAAE8AAAAAwkAATkAAAACBQAAAAF4BQAAAAF4CQABNgAAAAEJAABoAAAAAgAAAAAAAAAAAgAAAAAAAA9CQAk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9yd2FyZFBhc3NMYXllcjEAAAAEBQAAAAZpbnB1dHMFAAAADWxheWVyMVdlaWdodHMFAAAADGxheWVyMUJpYXNlcwIAAAAGTGF5ZXIxBAAAAAxsYXllcjFPdXRwdXQIBQAAAAskdDAyMTc0MjI3MgAAAAJfMQQAAAALZGVidWdMYXllcjEIBQAAAAskdDAyMTc0MjI3MgAAAAJfMgQAAAALJHQwMjI3NzIzODEJAQAAABFmb3J3YXJkUGFzc0xheWVyMgAAAAQFAAAADGxheWVyMU91dHB1dAUAAAANbGF5ZXIyV2VpZ2h0cwUAAAAMbGF5ZXIyQmlhc2VzAgAAAAZMYXllcjIEAAAADGxheWVyMk91dHB1dAgFAAAACyR0MDIyNzcyMzgxAAAAAl8xBAAAAAtkZWJ1Z0xheWVyMggFAAAACyR0MDIyNzcyMzgxAAAAAl8yCQAETgAAAAIJAAROAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAGcmVzdWx0BQAAAAxsYXllcjJPdXRwdXQFAAAAA25pbAUAAAALZGVidWdMYXllcjEFAAAAC2RlYnVnTGF5ZXIyAAAAAPbWsQs=", "height": 3082456, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HwyC8YbVJFQ1rUZWdjFea9Ep2RPaYKUJEWTMEip3U51S Next: CTK5XZL5t8cmyyJ2vqgR2bTBcRpvXGeA2RrB6hGC8GVB 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 | - | let layer1Biases = [- | |
6 | + | let layer1Biases = [-259050, -635637] | |
7 | 7 | ||
8 | - | let layer2Weights = [[ | |
8 | + | let layer2Weights = [[832965, -897142]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
12 | 12 | func exp_approximation (x) = { | |
13 | - | let e = 2718281 | |
13 | + | let e = toBigInt(2718281) | |
14 | 14 | let factor1 = x | |
15 | - | let factor2 = fraction((x * x), (2 * 1000000), 1000000) | |
16 | - | let factor3 = fraction(((x * x) * x), ((6 * 1000000) * 1000000), 1000000) | |
17 | - | let exp_approx = (((1000000 + factor1) + factor2) + factor3) | |
18 | - | exp_approx | |
15 | + | let factor2 = fraction((x * x), toBigInt((2 * 1000000)), toBigInt(1000000)) | |
16 | + | let factor3 = fraction(((x * x) * x), toBigInt(((6 * 1000000) * 1000000)), toBigInt(1000000)) | |
17 | + | fraction((((toBigInt(1000000) + factor1) + factor2) + factor3), toBigInt(1), toBigInt(1)) | |
19 | 18 | } | |
20 | 19 | ||
21 | 20 | ||
22 | 21 | func sigmoid (z,debugPrefix) = { | |
23 | - | let base = 1000000 | |
24 | - | let positiveZ = if ((0 > z)) | |
22 | + | let base = toBigInt(1000000) | |
23 | + | let positiveZ = toBigInt(if ((0 > z)) | |
25 | 24 | then -(z) | |
26 | - | else z | |
25 | + | else z) | |
27 | 26 | let expValue = exp_approximation(positiveZ) | |
28 | - | let sigValue = fraction(base, (base + expValue), | |
29 | - | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
27 | + | let sigValue = fraction(base, (base + expValue), toBigInt(1)) | |
28 | + | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), toInt(positiveZ)), IntegerEntry((debugPrefix + "expValue"), toInt(expValue)), IntegerEntry((debugPrefix + "sigValue"), toInt(sigValue))], toInt(sigValue)) | |
30 | 29 | } | |
31 | 30 | ||
32 | 31 | ||
33 | 32 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
34 | 33 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
35 | 34 | let sum1 = ((fraction(input[0], weights[1][0], 1000000) + fraction(input[1], weights[1][1], 1000000)) + biases[1]) | |
36 | - | let $ | |
37 | - | let debug0 = $ | |
38 | - | let sig0 = $ | |
39 | - | let $ | |
40 | - | let debug1 = $ | |
41 | - | let sig1 = $ | |
35 | + | let $t015111557 = sigmoid(sum0, "Layer1N0") | |
36 | + | let debug0 = $t015111557._1 | |
37 | + | let sig0 = $t015111557._2 | |
38 | + | let $t015621608 = sigmoid(sum1, "Layer1N1") | |
39 | + | let debug1 = $t015621608._1 | |
40 | + | let sig1 = $t015621608._2 | |
42 | 41 | $Tuple2([sig0, sig1], (debug0 ++ debug1)) | |
43 | 42 | } | |
44 | 43 | ||
45 | 44 | ||
46 | 45 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
47 | 46 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
48 | - | let $ | |
49 | - | let debug0 = $ | |
50 | - | let sig0 = $ | |
47 | + | let $t018771923 = sigmoid(sum0, "Layer2N0") | |
48 | + | let debug0 = $t018771923._1 | |
49 | + | let sig0 = $t018771923._2 | |
51 | 50 | $Tuple2(sig0, debug0) | |
52 | 51 | } | |
53 | 52 | ||
61 | 60 | then 1000000 | |
62 | 61 | else 0 | |
63 | 62 | let inputs = [scaledInput1, scaledInput2] | |
64 | - | let $ | |
65 | - | let layer1Output = $ | |
66 | - | let debugLayer1 = $ | |
67 | - | let $ | |
68 | - | let layer2Output = $ | |
69 | - | let debugLayer2 = $ | |
63 | + | let $t021742272 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
64 | + | let layer1Output = $t021742272._1 | |
65 | + | let debugLayer1 = $t021742272._2 | |
66 | + | let $t022772381 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
67 | + | let layer2Output = $t022772381._1 | |
68 | + | let debugLayer2 = $t022772381._2 | |
70 | 69 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
71 | 70 | } | |
72 | 71 |
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 | - | let layer1Biases = [- | |
6 | + | let layer1Biases = [-259050, -635637] | |
7 | 7 | ||
8 | - | let layer2Weights = [[ | |
8 | + | let layer2Weights = [[832965, -897142]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
12 | 12 | func exp_approximation (x) = { | |
13 | - | let e = 2718281 | |
13 | + | let e = toBigInt(2718281) | |
14 | 14 | let factor1 = x | |
15 | - | let factor2 = fraction((x * x), (2 * 1000000), 1000000) | |
16 | - | let factor3 = fraction(((x * x) * x), ((6 * 1000000) * 1000000), 1000000) | |
17 | - | let exp_approx = (((1000000 + factor1) + factor2) + factor3) | |
18 | - | exp_approx | |
15 | + | let factor2 = fraction((x * x), toBigInt((2 * 1000000)), toBigInt(1000000)) | |
16 | + | let factor3 = fraction(((x * x) * x), toBigInt(((6 * 1000000) * 1000000)), toBigInt(1000000)) | |
17 | + | fraction((((toBigInt(1000000) + factor1) + factor2) + factor3), toBigInt(1), toBigInt(1)) | |
19 | 18 | } | |
20 | 19 | ||
21 | 20 | ||
22 | 21 | func sigmoid (z,debugPrefix) = { | |
23 | - | let base = 1000000 | |
24 | - | let positiveZ = if ((0 > z)) | |
22 | + | let base = toBigInt(1000000) | |
23 | + | let positiveZ = toBigInt(if ((0 > z)) | |
25 | 24 | then -(z) | |
26 | - | else z | |
25 | + | else z) | |
27 | 26 | let expValue = exp_approximation(positiveZ) | |
28 | - | let sigValue = fraction(base, (base + expValue), | |
29 | - | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
27 | + | let sigValue = fraction(base, (base + expValue), toBigInt(1)) | |
28 | + | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), toInt(positiveZ)), IntegerEntry((debugPrefix + "expValue"), toInt(expValue)), IntegerEntry((debugPrefix + "sigValue"), toInt(sigValue))], toInt(sigValue)) | |
30 | 29 | } | |
31 | 30 | ||
32 | 31 | ||
33 | 32 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
34 | 33 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
35 | 34 | let sum1 = ((fraction(input[0], weights[1][0], 1000000) + fraction(input[1], weights[1][1], 1000000)) + biases[1]) | |
36 | - | let $ | |
37 | - | let debug0 = $ | |
38 | - | let sig0 = $ | |
39 | - | let $ | |
40 | - | let debug1 = $ | |
41 | - | let sig1 = $ | |
35 | + | let $t015111557 = sigmoid(sum0, "Layer1N0") | |
36 | + | let debug0 = $t015111557._1 | |
37 | + | let sig0 = $t015111557._2 | |
38 | + | let $t015621608 = sigmoid(sum1, "Layer1N1") | |
39 | + | let debug1 = $t015621608._1 | |
40 | + | let sig1 = $t015621608._2 | |
42 | 41 | $Tuple2([sig0, sig1], (debug0 ++ debug1)) | |
43 | 42 | } | |
44 | 43 | ||
45 | 44 | ||
46 | 45 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
47 | 46 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
48 | - | let $ | |
49 | - | let debug0 = $ | |
50 | - | let sig0 = $ | |
47 | + | let $t018771923 = sigmoid(sum0, "Layer2N0") | |
48 | + | let debug0 = $t018771923._1 | |
49 | + | let sig0 = $t018771923._2 | |
51 | 50 | $Tuple2(sig0, debug0) | |
52 | 51 | } | |
53 | 52 | ||
54 | 53 | ||
55 | 54 | @Callable(i) | |
56 | 55 | func predict (input1,input2) = { | |
57 | 56 | let scaledInput1 = if ((input1 == 1)) | |
58 | 57 | then 1000000 | |
59 | 58 | else 0 | |
60 | 59 | let scaledInput2 = if ((input2 == 1)) | |
61 | 60 | then 1000000 | |
62 | 61 | else 0 | |
63 | 62 | let inputs = [scaledInput1, scaledInput2] | |
64 | - | let $ | |
65 | - | let layer1Output = $ | |
66 | - | let debugLayer1 = $ | |
67 | - | let $ | |
68 | - | let layer2Output = $ | |
69 | - | let debugLayer2 = $ | |
63 | + | let $t021742272 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
64 | + | let layer1Output = $t021742272._1 | |
65 | + | let debugLayer1 = $t021742272._2 | |
66 | + | let $t022772381 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
67 | + | let layer2Output = $t022772381._1 | |
68 | + | let debugLayer2 = $t022772381._2 | |
70 | 69 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
71 | 70 | } | |
72 | 71 | ||
73 | 72 |
github/deemru/w8io/6500d08 49.82 ms ◑