tx · 6V35pBudomPg2sNkERM1SV5yreXyCvfUjZxcnWEAwv9b 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY: -0.01000000 Waves 2024.04.28 12:46 [3082542] smart account 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY > SELF 0.00000000 Waves
{ "type": 13, "id": "6V35pBudomPg2sNkERM1SV5yreXyCvfUjZxcnWEAwv9b", "fee": 1000000, "feeAssetId": null, "timestamp": 1714297589649, "version": 2, "chainId": 84, "sender": "3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY", "senderPublicKey": "2AWdnJuBMzufXSjTvzVcawBQQhnhF1iXR6QNVgwn33oc", "proofs": [ "5r1dbZNfwD4tGPxPkJvxC65mDEB7awUGDyegCkXiLtjLGYNqrNAw9Qk6e8v6Ch6pXBnFu9ASpPMCrm7R2Exuo9Sj" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAAAgAAAAADWxheWVyMVdlaWdodHMJAARMAAAAAgkABEwAAAACAAAAAAAACSmxCQAETAAAAAIAAAAAAAAJKp0FAAAAA25pbAkABEwAAAACCQAETAAAAAIAAAAAAAAGUfUJAARMAAAAAgAAAAAAAAZSLAUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMUJpYXNlcwkABEwAAAACAP///////AwWCQAETAAAAAIA///////2TQoFAAAAA25pbAAAAAANbGF5ZXIyV2VpZ2h0cwkABEwAAAACCQAETAAAAAIAAAAAAAAMtcYJAARMAAAAAgD///////JPiwUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMkJpYXNlcwkABEwAAAACAP//////+i8FBQAAAANuaWwBAAAACmV4cF9hcHByb3gAAAABAAAAAXgEAAAABXNjYWxlAAAAAAAAAYagAwkAAGYAAAACCQAAaAAAAAIA//////////oFAAAABXNjYWxlBQAAAAF4AAAAAAAAAAABAwkAAGYAAAACBQAAAAF4CQAAaAAAAAIAAAAAAAAAAAYFAAAABXNjYWxlBQAAAAVzY2FsZQQAAAAMY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gQAAAALJHQwMjcyMjI4MjYJAQAAABFmb3J3YXJkUGFzc0xheWVyMgAAAAQFAAAADGxheWVyMU91dHB1dAUAAAANbGF5ZXIyV2VpZ2h0cwUAAAAMbGF5ZXIyQmlhc2VzAgAAAAZMYXllcjIEAAAAC2RlYnVnTGF5ZXIyCAUAAAALJHQwMjcyMjI4MjYAAAACXzEEAAAADGxheWVyMk91dHB1dAgFAAAACyR0MDI3MjIyODI2AAAAAl8yCQAETgAAAAIJAAROAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAGcmVzdWx0BQAAAAxsYXllcjJPdXRwdXQFAAAAA25pbAUAAAALZGVidWdMYXllcjEFAAAAC2RlYnVnTGF5ZXIyAAAAAGwGHDc=", "height": 3082542, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4mYq43JfanRZQyBETXNzpVZnazq9HeDF1xkokwGuKXa5 Next: EagziTUuatBGN4yrywpoprrknF46urgJ1q46iavxr1Ng 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, 414252]] | |
5 | 5 | ||
6 | - | let layer1Biases = [-259050, - | |
6 | + | let layer1Biases = [-259050, -635638] | |
7 | 7 | ||
8 | - | let layer2Weights = [[ | |
8 | + | let layer2Weights = [[832966, -897141]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 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 scale | |
18 | + | else { | |
19 | + | let coefficients = [$Tuple2(60000, (scale - 1)), $Tuple2(50000, (scale - 2)), $Tuple2(40000, (scale - 3)), $Tuple2(30000, (scale - 10)), $Tuple2(20000, (scale - 20)), $Tuple2(10000, (scale - 30)), $Tuple2(0, scale), $Tuple2(-10000, (scale + 30)), $Tuple2(-20000, (scale + 20)), $Tuple2(-30000, (scale + 10)), $Tuple2(-40000, (scale + 3)), $Tuple2(-50000, (scale + 2)), $Tuple2(-60000, (scale + 1))] | |
20 | + | let index = ((x + 60000) / 10000) | |
21 | + | let $t0926968 = coefficients[index] | |
22 | + | let coefficient = $t0926968._1 | |
23 | + | let y = $t0926968._2 | |
24 | + | y | |
25 | + | } | |
26 | + | } | |
27 | + | ||
28 | + | ||
12 | 29 | func sigmoid (z,debugPrefix) = { | |
13 | - | let e = 2718281 | |
14 | - | let base = 1000000 | |
30 | + | let base = 100000 | |
15 | 31 | let positiveZ = if ((0 > z)) | |
16 | 32 | then -(z) | |
17 | 33 | else z | |
18 | - | let | |
19 | - | let sigValue = | |
20 | - | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + " | |
34 | + | let expValue = exp_approx(positiveZ) | |
35 | + | let sigValue = (base - ((base * base) / (base + expValue))) | |
36 | + | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
21 | 37 | } | |
22 | 38 | ||
23 | 39 | ||
24 | 40 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
25 | - | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
26 | - | let sum1 = ((fraction(input[0], weights[1][0], 1000000) + fraction(input[1], weights[1][1], 1000000)) + biases[1]) | |
27 | - | let $t010791125 = sigmoid(sum0, "Layer1N0") | |
28 | - | let debug0 = $t010791125._1 | |
29 | - | let sig0 = $t010791125._2 | |
30 | - | let $t011301176 = sigmoid(sum1, "Layer1N1") | |
31 | - | let debug1 = $t011301176._1 | |
32 | - | let sig1 = $t011301176._2 | |
33 | - | $Tuple2([sig0, sig1], (debug0 ++ debug1)) | |
41 | + | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
42 | + | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
43 | + | let $t018331886 = sigmoid(sum0, "Layer1N0") | |
44 | + | let debugEntries0 = $t018331886._1 | |
45 | + | let sig0 = $t018331886._2 | |
46 | + | let $t018911944 = sigmoid(sum1, "Layer1N1") | |
47 | + | let debugEntries1 = $t018911944._1 | |
48 | + | let sig1 = $t018911944._2 | |
49 | + | let debugInfo = (debugEntries0 ++ debugEntries1) | |
50 | + | let output = [sig0, sig1] | |
51 | + | $Tuple2(debugInfo, output) | |
34 | 52 | } | |
35 | 53 | ||
36 | 54 | ||
37 | 55 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
38 | - | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
39 | - | let $t014451491 = sigmoid(sum0, "Layer2N0") | |
40 | - | let debug0 = $t014451491._1 | |
41 | - | let sig0 = $t014451491._2 | |
42 | - | $Tuple2(sig0, debug0) | |
56 | + | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
57 | + | let $t022542307 = sigmoid(sum0, "Layer2N0") | |
58 | + | let debugEntries0 = $t022542307._1 | |
59 | + | let sig0 = $t022542307._2 | |
60 | + | let debugInfo = debugEntries0 | |
61 | + | let output = sig0 | |
62 | + | $Tuple2(debugInfo, output) | |
43 | 63 | } | |
44 | 64 | ||
45 | 65 | ||
52 | 72 | then 1000000 | |
53 | 73 | else 0 | |
54 | 74 | let inputs = [scaledInput1, scaledInput2] | |
55 | - | let $ | |
56 | - | let | |
57 | - | let | |
58 | - | let $ | |
59 | - | let | |
60 | - | let | |
75 | + | let $t026192717 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
76 | + | let debugLayer1 = $t026192717._1 | |
77 | + | let layer1Output = $t026192717._2 | |
78 | + | let $t027222826 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
79 | + | let debugLayer2 = $t027222826._1 | |
80 | + | let layer2Output = $t027222826._2 | |
61 | 81 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
62 | 82 | } | |
63 | 83 |
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, 414252]] | |
5 | 5 | ||
6 | - | let layer1Biases = [-259050, - | |
6 | + | let layer1Biases = [-259050, -635638] | |
7 | 7 | ||
8 | - | let layer2Weights = [[ | |
8 | + | let layer2Weights = [[832966, -897141]] | |
9 | 9 | ||
10 | 10 | let layer2Biases = [-381179] | |
11 | 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 scale | |
18 | + | else { | |
19 | + | let coefficients = [$Tuple2(60000, (scale - 1)), $Tuple2(50000, (scale - 2)), $Tuple2(40000, (scale - 3)), $Tuple2(30000, (scale - 10)), $Tuple2(20000, (scale - 20)), $Tuple2(10000, (scale - 30)), $Tuple2(0, scale), $Tuple2(-10000, (scale + 30)), $Tuple2(-20000, (scale + 20)), $Tuple2(-30000, (scale + 10)), $Tuple2(-40000, (scale + 3)), $Tuple2(-50000, (scale + 2)), $Tuple2(-60000, (scale + 1))] | |
20 | + | let index = ((x + 60000) / 10000) | |
21 | + | let $t0926968 = coefficients[index] | |
22 | + | let coefficient = $t0926968._1 | |
23 | + | let y = $t0926968._2 | |
24 | + | y | |
25 | + | } | |
26 | + | } | |
27 | + | ||
28 | + | ||
12 | 29 | func sigmoid (z,debugPrefix) = { | |
13 | - | let e = 2718281 | |
14 | - | let base = 1000000 | |
30 | + | let base = 100000 | |
15 | 31 | let positiveZ = if ((0 > z)) | |
16 | 32 | then -(z) | |
17 | 33 | else z | |
18 | - | let | |
19 | - | let sigValue = | |
20 | - | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + " | |
34 | + | let expValue = exp_approx(positiveZ) | |
35 | + | let sigValue = (base - ((base * base) / (base + expValue))) | |
36 | + | $Tuple2([IntegerEntry((debugPrefix + "positiveZ"), positiveZ), IntegerEntry((debugPrefix + "expValue"), expValue), IntegerEntry((debugPrefix + "sigValue"), sigValue)], sigValue) | |
21 | 37 | } | |
22 | 38 | ||
23 | 39 | ||
24 | 40 | func forwardPassLayer1 (input,weights,biases,debugPrefix) = { | |
25 | - | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
26 | - | let sum1 = ((fraction(input[0], weights[1][0], 1000000) + fraction(input[1], weights[1][1], 1000000)) + biases[1]) | |
27 | - | let $t010791125 = sigmoid(sum0, "Layer1N0") | |
28 | - | let debug0 = $t010791125._1 | |
29 | - | let sig0 = $t010791125._2 | |
30 | - | let $t011301176 = sigmoid(sum1, "Layer1N1") | |
31 | - | let debug1 = $t011301176._1 | |
32 | - | let sig1 = $t011301176._2 | |
33 | - | $Tuple2([sig0, sig1], (debug0 ++ debug1)) | |
41 | + | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
42 | + | let sum1 = (((input[0] * weights[1][0]) + (input[1] * weights[1][1])) + (biases[1] * 100000)) | |
43 | + | let $t018331886 = sigmoid(sum0, "Layer1N0") | |
44 | + | let debugEntries0 = $t018331886._1 | |
45 | + | let sig0 = $t018331886._2 | |
46 | + | let $t018911944 = sigmoid(sum1, "Layer1N1") | |
47 | + | let debugEntries1 = $t018911944._1 | |
48 | + | let sig1 = $t018911944._2 | |
49 | + | let debugInfo = (debugEntries0 ++ debugEntries1) | |
50 | + | let output = [sig0, sig1] | |
51 | + | $Tuple2(debugInfo, output) | |
34 | 52 | } | |
35 | 53 | ||
36 | 54 | ||
37 | 55 | func forwardPassLayer2 (input,weights,biases,debugPrefix) = { | |
38 | - | let sum0 = ((fraction(input[0], weights[0][0], 1000000) + fraction(input[1], weights[0][1], 1000000)) + biases[0]) | |
39 | - | let $t014451491 = sigmoid(sum0, "Layer2N0") | |
40 | - | let debug0 = $t014451491._1 | |
41 | - | let sig0 = $t014451491._2 | |
42 | - | $Tuple2(sig0, debug0) | |
56 | + | let sum0 = (((input[0] * weights[0][0]) + (input[1] * weights[0][1])) + (biases[0] * 100000)) | |
57 | + | let $t022542307 = sigmoid(sum0, "Layer2N0") | |
58 | + | let debugEntries0 = $t022542307._1 | |
59 | + | let sig0 = $t022542307._2 | |
60 | + | let debugInfo = debugEntries0 | |
61 | + | let output = sig0 | |
62 | + | $Tuple2(debugInfo, output) | |
43 | 63 | } | |
44 | 64 | ||
45 | 65 | ||
46 | 66 | @Callable(i) | |
47 | 67 | func predict (input1,input2) = { | |
48 | 68 | let scaledInput1 = if ((input1 == 1)) | |
49 | 69 | then 1000000 | |
50 | 70 | else 0 | |
51 | 71 | let scaledInput2 = if ((input2 == 1)) | |
52 | 72 | then 1000000 | |
53 | 73 | else 0 | |
54 | 74 | let inputs = [scaledInput1, scaledInput2] | |
55 | - | let $ | |
56 | - | let | |
57 | - | let | |
58 | - | let $ | |
59 | - | let | |
60 | - | let | |
75 | + | let $t026192717 = forwardPassLayer1(inputs, layer1Weights, layer1Biases, "Layer1") | |
76 | + | let debugLayer1 = $t026192717._1 | |
77 | + | let layer1Output = $t026192717._2 | |
78 | + | let $t027222826 = forwardPassLayer2(layer1Output, layer2Weights, layer2Biases, "Layer2") | |
79 | + | let debugLayer2 = $t027222826._1 | |
80 | + | let layer2Output = $t027222826._2 | |
61 | 81 | (([IntegerEntry("result", layer2Output)] ++ debugLayer1) ++ debugLayer2) | |
62 | 82 | } | |
63 | 83 | ||
64 | 84 |
github/deemru/w8io/169f3d6 26.94 ms ◑