tx · CTK5XZL5t8cmyyJ2vqgR2bTBcRpvXGeA2RrB6hGC8GVB 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY: -0.01000000 Waves 2024.04.28 11:26 [3082465] smart account 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY > SELF 0.00000000 Waves
{ "type": 13, "id": "CTK5XZL5t8cmyyJ2vqgR2bTBcRpvXGeA2RrB6hGC8GVB", "fee": 1000000, "feeAssetId": null, "timestamp": 1714292777376, "version": 2, "chainId": 84, "sender": "3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY", "senderPublicKey": "2AWdnJuBMzufXSjTvzVcawBQQhnhF1iXR6QNVgwn33oc", "proofs": [ "235Csg3re1txjvvECKHzUCogjAGHmxmCPkkCvxiBfZg6z8jtdYwd7JmpiJziBBDx37XE3EsQcEggWY2NBXU9STco" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAAAgAAAAADWxheWVyMVdlaWdodHMJAARMAAAAAgkABEwAAAACAAAAAAAACSmxCQAETAAAAAIAAAAAAAAJKp0FAAAAA25pbAkABEwAAAACCQAETAAAAAIAAAAAAAAGUfUJAARMAAAAAgAAAAAAAAZSLQUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMUJpYXNlcwkABEwAAAACAP///////AwWCQAETAAAAAIA///////2TQoFAAAAA25pbAAAAAANbGF5ZXIyV2VpZ2h0cwkABEwAAAACCQAETAAAAAIAAAAAAAAMtcUJAARMAAAAAgD///////JPigUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMkJpYXNlcwkABEwAAAACAP//////+i8FBQAAAANuaWwBAAAAEWV4cF9hcHByb3hpbWF0aW9uAAAAAQAAAAF4BAAAAAVzY2FsZQkAATYAAAABAAAAAAAAAYagBAAAAAFlCQABNgAAAAEAAAAAAAAEJdQEAAAAB2ZhY3RvcjEJAAE8AAAAAwUAAAABeAUAAAAFc2NhbGUJAAE2AAAAAQAAAAAAAAAAAQQAAAAHZmFjdG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AAAAAAACBQAAAAZpbnB1dDIAAAAAAAAAAAEAAAAAAAAPQkAAAAAAAAAAAAAEAAAABmlucHV0cwkABEwAAAACBQAAAAxzY2FsZWRJbnB1dDEJAARMAAAAAgUAAAAMc2NhbGVkSW5wdXQyBQAAAANuaWwEAAAACyR0MDIzODcyNDg1CQEAAAARZm9yd2FyZFBhc3NMYXllcjEAAAAEBQAAAAZpbnB1dHMFAAAADWxheWVyMVdlaWdodHMFAAAADGxheWVyMUJpYXNlcwIAAAAGTGF5ZXIxBAAAAAxsYXllcjFPdXRwdXQIBQAAAAskdDAyMzg3MjQ4NQAAAAJfMQQAAAALZGVidWdMYXllcjEIBQAAAAskdDAyMzg3MjQ4NQAAAAJfMgQAAAALJHQwMjQ5MDI1OTQJAQAAABFmb3J3YXJkUGFzc0xheWVyMgAAAAQFAAAADGxheWVyMU91dHB1dAUAAAANbGF5ZXIyV2VpZ2h0cwUAAAAMbGF5ZXIyQmlhc2VzAgAAAAZMYXllcjIEAAAADGxheWVyMk91dHB1dAgFAAAACyR0MDI0OTAyNTk0AAAAAl8xBAAAAAtkZWJ1Z0xheWVyMggFAAAACyR0MDI0OTAyNTk0AAAAAl8yCQAETgAAAAIJAAROAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAGcmVzdWx0BQAAAAxsYXllcjJPdXRwdXQFAAAAA25pbAUAAAALZGVidWdMYXllcjEFAAAAC2RlYnVnTGF5ZXIyAAAAAEKODyA=", "height": 3082465, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8cdRbGHsNfmgK7NCToFRuLF7cqYNwNiYjBcET9w8VCPR Next: AwRrLAxF5aEBEdiTUheEyimrHT9gq5mRd1ki8zFuTWZw 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 = [[600497, 600733], [414197, 414253]] | |
5 | 5 | ||
6 | - | let layer1Biases = [-259050, - | |
6 | + | let layer1Biases = [-259050, -635638] | |
7 | 7 | ||
8 | 8 | let layer2Weights = [[832965, -897142]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
12 | 12 | func exp_approximation (x) = { | |
13 | - | let e = toBigInt(2718281) | |
14 | - | let factor1 = x | |
15 | - | let factor2 = fraction((x * x), toBigInt((2 * 1000000)), toBigInt(1000000)) | |
16 | - | let factor3 = fraction(((x * x) * x), toBigInt(((6 * 1000000) * 1000000)), toBigInt(1000000)) | |
13 | + | let scale = toBigInt(100000) | |
14 | + | let e = toBigInt(271828) | |
15 | + | let factor1 = fraction(x, scale, toBigInt(1)) | |
16 | + | let factor2 = fraction(fraction((x * x), scale, toBigInt(1)), toBigInt((2 * 100000)), toBigInt(1)) | |
17 | + | let factor3 = fraction(fraction(((x * x) * x), scale, toBigInt(1)), toBigInt(((6 * 100000) * 100000)), toBigInt(1)) | |
17 | 18 | fraction((((toBigInt(1000000) + factor1) + factor2) + factor3), toBigInt(1), toBigInt(1)) | |
18 | 19 | } | |
19 | 20 | ||
20 | 21 | ||
21 | 22 | func sigmoid (z,debugPrefix) = { | |
22 | - | let base = toBigInt( | |
23 | + | let base = toBigInt(100000) | |
23 | 24 | let positiveZ = toBigInt(if ((0 > z)) | |
24 | 25 | then -(z) | |
25 | 26 | else z) | |
32 | 33 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
33 | 34 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
34 | 35 | let sum1 = ((fraction(input[0], weights[1][0], 1000000) + fraction(input[1], weights[1][1], 1000000)) + biases[1]) | |
35 | - | let $ | |
36 | - | let debug0 = $ | |
37 | - | let sig0 = $ | |
38 | - | let $ | |
39 | - | let debug1 = $ | |
40 | - | let sig1 = $ | |
36 | + | let $t017241770 = sigmoid(sum0, "Layer1N0") | |
37 | + | let debug0 = $t017241770._1 | |
38 | + | let sig0 = $t017241770._2 | |
39 | + | let $t017751821 = sigmoid(sum1, "Layer1N1") | |
40 | + | let debug1 = $t017751821._1 | |
41 | + | let sig1 = $t017751821._2 | |
41 | 42 | $Tuple2([sig0, sig1], (debug0 ++ debug1)) | |
42 | 43 | } | |
43 | 44 | ||
44 | 45 | ||
45 | 46 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
46 | 47 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
47 | - | let $ | |
48 | - | let debug0 = $ | |
49 | - | let sig0 = $ | |
48 | + | let $t020902136 = sigmoid(sum0, "Layer2N0") | |
49 | + | let debug0 = $t020902136._1 | |
50 | + | let sig0 = $t020902136._2 | |
50 | 51 | $Tuple2(sig0, debug0) | |
51 | 52 | } | |
52 | 53 | ||
60 | 61 | then 1000000 | |
61 | 62 | else 0 | |
62 | 63 | let inputs = [scaledInput1, scaledInput2] | |
63 | - | let $ | |
64 | - | let layer1Output = $ | |
65 | - | let debugLayer1 = $ | |
66 | - | let $ | |
67 | - | let layer2Output = $ | |
68 | - | let debugLayer2 = $ | |
64 | + | let $t023872485 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
65 | + | let layer1Output = $t023872485._1 | |
66 | + | let debugLayer1 = $t023872485._2 | |
67 | + | let $t024902594 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
68 | + | let layer2Output = $t024902594._1 | |
69 | + | let debugLayer2 = $t024902594._2 | |
69 | 70 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
70 | 71 | } | |
71 | 72 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let layer1Weights = [[ | |
4 | + | let layer1Weights = [[600497, 600733], [414197, 414253]] | |
5 | 5 | ||
6 | - | let layer1Biases = [-259050, - | |
6 | + | let layer1Biases = [-259050, -635638] | |
7 | 7 | ||
8 | 8 | let layer2Weights = [[832965, -897142]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
12 | 12 | func exp_approximation (x) = { | |
13 | - | let e = toBigInt(2718281) | |
14 | - | let factor1 = x | |
15 | - | let factor2 = fraction((x * x), toBigInt((2 * 1000000)), toBigInt(1000000)) | |
16 | - | let factor3 = fraction(((x * x) * x), toBigInt(((6 * 1000000) * 1000000)), toBigInt(1000000)) | |
13 | + | let scale = toBigInt(100000) | |
14 | + | let e = toBigInt(271828) | |
15 | + | let factor1 = fraction(x, scale, toBigInt(1)) | |
16 | + | let factor2 = fraction(fraction((x * x), scale, toBigInt(1)), toBigInt((2 * 100000)), toBigInt(1)) | |
17 | + | let factor3 = fraction(fraction(((x * x) * x), scale, toBigInt(1)), toBigInt(((6 * 100000) * 100000)), toBigInt(1)) | |
17 | 18 | fraction((((toBigInt(1000000) + factor1) + factor2) + factor3), toBigInt(1), toBigInt(1)) | |
18 | 19 | } | |
19 | 20 | ||
20 | 21 | ||
21 | 22 | func sigmoid (z,debugPrefix) = { | |
22 | - | let base = toBigInt( | |
23 | + | let base = toBigInt(100000) | |
23 | 24 | let positiveZ = toBigInt(if ((0 > z)) | |
24 | 25 | then -(z) | |
25 | 26 | else z) | |
26 | 27 | let expValue = exp_approximation(positiveZ) | |
27 | 28 | let sigValue = fraction(base, (base + expValue), toBigInt(1)) | |
28 | 29 | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), toInt(positiveZ)), IntegerEntry((debugPrefix + "expValue"), toInt(expValue)), IntegerEntry((debugPrefix + "sigValue"), toInt(sigValue))], toInt(sigValue)) | |
29 | 30 | } | |
30 | 31 | ||
31 | 32 | ||
32 | 33 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
33 | 34 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
34 | 35 | let sum1 = ((fraction(input[0], weights[1][0], 1000000) + fraction(input[1], weights[1][1], 1000000)) + biases[1]) | |
35 | - | let $ | |
36 | - | let debug0 = $ | |
37 | - | let sig0 = $ | |
38 | - | let $ | |
39 | - | let debug1 = $ | |
40 | - | let sig1 = $ | |
36 | + | let $t017241770 = sigmoid(sum0, "Layer1N0") | |
37 | + | let debug0 = $t017241770._1 | |
38 | + | let sig0 = $t017241770._2 | |
39 | + | let $t017751821 = sigmoid(sum1, "Layer1N1") | |
40 | + | let debug1 = $t017751821._1 | |
41 | + | let sig1 = $t017751821._2 | |
41 | 42 | $Tuple2([sig0, sig1], (debug0 ++ debug1)) | |
42 | 43 | } | |
43 | 44 | ||
44 | 45 | ||
45 | 46 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
46 | 47 | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
47 | - | let $ | |
48 | - | let debug0 = $ | |
49 | - | let sig0 = $ | |
48 | + | let $t020902136 = sigmoid(sum0, "Layer2N0") | |
49 | + | let debug0 = $t020902136._1 | |
50 | + | let sig0 = $t020902136._2 | |
50 | 51 | $Tuple2(sig0, debug0) | |
51 | 52 | } | |
52 | 53 | ||
53 | 54 | ||
54 | 55 | @Callable(i) | |
55 | 56 | func predict (input1,input2) = { | |
56 | 57 | let scaledInput1 = if ((input1 == 1)) | |
57 | 58 | then 1000000 | |
58 | 59 | else 0 | |
59 | 60 | let scaledInput2 = if ((input2 == 1)) | |
60 | 61 | then 1000000 | |
61 | 62 | else 0 | |
62 | 63 | let inputs = [scaledInput1, scaledInput2] | |
63 | - | let $ | |
64 | - | let layer1Output = $ | |
65 | - | let debugLayer1 = $ | |
66 | - | let $ | |
67 | - | let layer2Output = $ | |
68 | - | let debugLayer2 = $ | |
64 | + | let $t023872485 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
65 | + | let layer1Output = $t023872485._1 | |
66 | + | let debugLayer1 = $t023872485._2 | |
67 | + | let $t024902594 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
68 | + | let layer2Output = $t024902594._1 | |
69 | + | let debugLayer2 = $t024902594._2 | |
69 | 70 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
70 | 71 | } | |
71 | 72 | ||
72 | 73 |
github/deemru/w8io/169f3d6 32.41 ms ◑