tx · GtG7mCapTmYceaRkKY1vhdnd2yLu3vXtwL6gnTomt2N9 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY: -0.01000000 Waves 2024.04.28 14:25 [3082655] smart account 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY > SELF 0.00000000 Waves
{ "type": 13, "id": "GtG7mCapTmYceaRkKY1vhdnd2yLu3vXtwL6gnTomt2N9", "fee": 1000000, "feeAssetId": null, "timestamp": 1714303469498, "version": 2, "chainId": 84, "sender": "3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY", "senderPublicKey": "2AWdnJuBMzufXSjTvzVcawBQQhnhF1iXR6QNVgwn33oc", "proofs": [ "21SPdzhzPPKjDKz7mSUHHX6qmiQY9Ucrh6vTU8dNKvwpjvFJ1SmHyx6K5H2Z7THDSECMmeLa6VuPLj2sKdXJEon6" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAAAgAAAAADWxheWVyMVdlaWdodHMJAARMAAAAAgkABEwAAAACAAAAAAAACSmxCQAETAAAAAIAAAAAAAAJKpwFAAAAA25pbAkABEwAAAACCQAETAAAAAIAAAAAAAAGUfUJAARMAAAAAgAAAAAAAAZSLQUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMUJpYXNlcwkABEwAAAACAP///////AwVCQAETAAAAAIA///////2TQsFAAAAA25pbAAAAAANbGF5ZXIyV2VpZ2h0cwkABEwAAAACCQAETAAAAAIAAAAAAAAMtcYJAARMAAAAAgD///////JPigUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMkJpYXNlcwkABEwAAAACAP//////+i8FBQAAAANuaWwBAAAACWV4cEFwcHJveAAAAAEAAAABeAQAAAAHc2NhbGVkWAkAAGsAAAADBQAAAAF4AAAAAAAAAAABAAAAAAAAD0JABAAAAAhzY2FsZWRYMgkAAGsAAAADBQAAAAdzY2FsZWRYBQAAAAdzY2FsZWRYAAAAAAAAD0JABAAAAAV0ZXJtMQkAAGUAAAACAAAAAAA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ABkxheWVyMQQAAAALZGVidWdMYXllcjEIBQAAAAskdDAyMTEzMjIxMQAAAAJfMQQAAAAMbGF5ZXIxT3V0cHV0CAUAAAALJHQwMjExMzIyMTEAAAACXzIEAAAACyR0MDIyMTYyMzIwCQEAAAARZm9yd2FyZFBhc3NMYXllcjIAAAAEBQAAAAxsYXllcjFPdXRwdXQFAAAADWxheWVyMldlaWdodHMFAAAADGxheWVyMkJpYXNlcwIAAAAGTGF5ZXIyBAAAAAtkZWJ1Z0xheWVyMggFAAAACyR0MDIyMTYyMzIwAAAAAl8xBAAAAAxsYXllcjJPdXRwdXQIBQAAAAskdDAyMjE2MjMyMAAAAAJfMgkABE4AAAACCQAETgAAAAIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAABnJlc3VsdAUAAAAMbGF5ZXIyT3V0cHV0BQAAAANuaWwFAAAAC2RlYnVnTGF5ZXIxBQAAAAtkZWJ1Z0xheWVyMgAAAADdWWHy", "height": 3082655, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8Tiq9PrpLGFMXBGGABe7MVibryxyyrcnbvTnKbFxbEWk Next: CdzzpSdtWkMdq88oLky7G7s1vveHjZQsJ1rC8WaAeC1X 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, 600732], [414197, 414253]] | |
5 | 5 | ||
6 | 6 | let layer1Biases = [-259051, -635637] | |
7 | 7 | ||
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
12 | - | func clampZ (z,limit) = if ((z > limit)) | |
13 | - | then limit | |
14 | - | else if ((-(limit) > z)) | |
15 | - | then -(limit) | |
16 | - | else z | |
17 | - | ||
18 | - | ||
19 | - | func exp_approx (x) = { | |
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)) | |
12 | + | func expApprox (x) = { | |
13 | + | let scaledX = fraction(x, 1, 1000000) | |
14 | + | let scaledX2 = fraction(scaledX, scaledX, 1000000) | |
15 | + | let term1 = (1000000 - scaledX) | |
16 | + | let term2 = fraction(scaledX2, 500000, 1) | |
17 | + | (term1 + term2) | |
28 | 18 | } | |
29 | 19 | ||
30 | 20 | ||
31 | 21 | func sigmoid (z,debugPrefix) = { | |
32 | - | let | |
33 | - | let | |
34 | - | let sigValue = fraction( | |
35 | - | $Tuple2([IntegerEntry((debugPrefix + "inputZ"), z), IntegerEntry((debugPrefix + " | |
22 | + | let expNegZ = expApprox(-(z)) | |
23 | + | let onePlusExpNegZ = (1000000 + expNegZ) | |
24 | + | let sigValue = fraction(1000000000000, onePlusExpNegZ, 1) | |
25 | + | $Tuple2([IntegerEntry((debugPrefix + "inputZ"), z), IntegerEntry((debugPrefix + "expNegZ"), expNegZ), IntegerEntry((debugPrefix + "onePlusExpNegZ"), onePlusExpNegZ), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
36 | 26 | } | |
37 | 27 | ||
38 | 28 | ||
39 | 29 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
40 | 30 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
41 | 31 | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
42 | - | let $ | |
43 | - | let debugEntries0 = $ | |
44 | - | let sig0 = $ | |
45 | - | let $ | |
46 | - | let debugEntries1 = $ | |
47 | - | let sig1 = $ | |
32 | + | let $t013271380 = sigmoid(sum0, "Layer1N0") | |
33 | + | let debugEntries0 = $t013271380._1 | |
34 | + | let sig0 = $t013271380._2 | |
35 | + | let $t013851438 = sigmoid(sum1, "Layer1N1") | |
36 | + | let debugEntries1 = $t013851438._1 | |
37 | + | let sig1 = $t013851438._2 | |
48 | 38 | let debugInfo = (debugEntries0 ++ debugEntries1) | |
49 | 39 | let output = [sig0, sig1] | |
50 | 40 | $Tuple2(debugInfo, output) | |
53 | 43 | ||
54 | 44 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
55 | 45 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
56 | - | let $ | |
57 | - | let debugEntries0 = $ | |
58 | - | let sig0 = $ | |
46 | + | let $t017481801 = sigmoid(sum0, "Layer2N0") | |
47 | + | let debugEntries0 = $t017481801._1 | |
48 | + | let sig0 = $t017481801._2 | |
59 | 49 | let debugInfo = debugEntries0 | |
60 | 50 | let output = sig0 | |
61 | 51 | $Tuple2(debugInfo, output) | |
71 | 61 | then 1000000 | |
72 | 62 | else 0 | |
73 | 63 | let inputs = [scaledInput1, scaledInput2] | |
74 | - | let $ | |
75 | - | let debugLayer1 = $ | |
76 | - | let layer1Output = $ | |
77 | - | let $ | |
78 | - | let debugLayer2 = $ | |
79 | - | let layer2Output = $ | |
64 | + | let $t021132211 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
65 | + | let debugLayer1 = $t021132211._1 | |
66 | + | let layer1Output = $t021132211._2 | |
67 | + | let $t022162320 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
68 | + | let debugLayer2 = $t022162320._1 | |
69 | + | let layer2Output = $t022162320._2 | |
80 | 70 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
81 | 71 | } | |
82 | 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, 600732], [414197, 414253]] | |
5 | 5 | ||
6 | 6 | let layer1Biases = [-259051, -635637] | |
7 | 7 | ||
8 | 8 | let layer2Weights = [[832966, -897142]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 11 | ||
12 | - | func clampZ (z,limit) = if ((z > limit)) | |
13 | - | then limit | |
14 | - | else if ((-(limit) > z)) | |
15 | - | then -(limit) | |
16 | - | else z | |
17 | - | ||
18 | - | ||
19 | - | func exp_approx (x) = { | |
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)) | |
12 | + | func expApprox (x) = { | |
13 | + | let scaledX = fraction(x, 1, 1000000) | |
14 | + | let scaledX2 = fraction(scaledX, scaledX, 1000000) | |
15 | + | let term1 = (1000000 - scaledX) | |
16 | + | let term2 = fraction(scaledX2, 500000, 1) | |
17 | + | (term1 + term2) | |
28 | 18 | } | |
29 | 19 | ||
30 | 20 | ||
31 | 21 | func sigmoid (z,debugPrefix) = { | |
32 | - | let | |
33 | - | let | |
34 | - | let sigValue = fraction( | |
35 | - | $Tuple2([IntegerEntry((debugPrefix + "inputZ"), z), IntegerEntry((debugPrefix + " | |
22 | + | let expNegZ = expApprox(-(z)) | |
23 | + | let onePlusExpNegZ = (1000000 + expNegZ) | |
24 | + | let sigValue = fraction(1000000000000, onePlusExpNegZ, 1) | |
25 | + | $Tuple2([IntegerEntry((debugPrefix + "inputZ"), z), IntegerEntry((debugPrefix + "expNegZ"), expNegZ), IntegerEntry((debugPrefix + "onePlusExpNegZ"), onePlusExpNegZ), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
36 | 26 | } | |
37 | 27 | ||
38 | 28 | ||
39 | 29 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
40 | 30 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
41 | 31 | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
42 | - | let $ | |
43 | - | let debugEntries0 = $ | |
44 | - | let sig0 = $ | |
45 | - | let $ | |
46 | - | let debugEntries1 = $ | |
47 | - | let sig1 = $ | |
32 | + | let $t013271380 = sigmoid(sum0, "Layer1N0") | |
33 | + | let debugEntries0 = $t013271380._1 | |
34 | + | let sig0 = $t013271380._2 | |
35 | + | let $t013851438 = sigmoid(sum1, "Layer1N1") | |
36 | + | let debugEntries1 = $t013851438._1 | |
37 | + | let sig1 = $t013851438._2 | |
48 | 38 | let debugInfo = (debugEntries0 ++ debugEntries1) | |
49 | 39 | let output = [sig0, sig1] | |
50 | 40 | $Tuple2(debugInfo, output) | |
51 | 41 | } | |
52 | 42 | ||
53 | 43 | ||
54 | 44 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
55 | 45 | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
56 | - | let $ | |
57 | - | let debugEntries0 = $ | |
58 | - | let sig0 = $ | |
46 | + | let $t017481801 = sigmoid(sum0, "Layer2N0") | |
47 | + | let debugEntries0 = $t017481801._1 | |
48 | + | let sig0 = $t017481801._2 | |
59 | 49 | let debugInfo = debugEntries0 | |
60 | 50 | let output = sig0 | |
61 | 51 | $Tuple2(debugInfo, output) | |
62 | 52 | } | |
63 | 53 | ||
64 | 54 | ||
65 | 55 | @Callable(i) | |
66 | 56 | func predict (input1,input2) = { | |
67 | 57 | let scaledInput1 = if ((input1 == 1)) | |
68 | 58 | then 1000000 | |
69 | 59 | else 0 | |
70 | 60 | let scaledInput2 = if ((input2 == 1)) | |
71 | 61 | then 1000000 | |
72 | 62 | else 0 | |
73 | 63 | let inputs = [scaledInput1, scaledInput2] | |
74 | - | let $ | |
75 | - | let debugLayer1 = $ | |
76 | - | let layer1Output = $ | |
77 | - | let $ | |
78 | - | let debugLayer2 = $ | |
79 | - | let layer2Output = $ | |
64 | + | let $t021132211 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
65 | + | let debugLayer1 = $t021132211._1 | |
66 | + | let layer1Output = $t021132211._2 | |
67 | + | let $t022162320 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
68 | + | let debugLayer2 = $t022162320._1 | |
69 | + | let layer2Output = $t022162320._2 | |
80 | 70 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
81 | 71 | } | |
82 | 72 | ||
83 | 73 |
github/deemru/w8io/026f985 28.67 ms ◑