tx · CrFqEGY8DWvwsYq3yExJteW66i3hdNFg277CA3AXDGFm
3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY: -0.01000000 Waves
2024.05.04 11:41 [3091156] smart account 3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY > SELF 0.00000000 Waves
{
"type": 13,
"id": "CrFqEGY8DWvwsYq3yExJteW66i3hdNFg277CA3AXDGFm",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1714812142861,
"version": 2,
"chainId": 84,
"sender": "3N3n75UqB8G1GKmXFr4zPhKCjGcqJPRSuJY",
"senderPublicKey": "2AWdnJuBMzufXSjTvzVcawBQQhnhF1iXR6QNVgwn33oc",
"proofs": [
"4vsrxw6zxrmHWGFf3ymbpdr2gD2nVUAYg8k9JBr2kmbJKg8fB4AjELMPV8w8Uu1dcyjmjkLdJpvyZSJytdd62ebj"
],
"script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAAAgAAAAADWxheWVyMVdlaWdodHMJAARMAAAAAgkABEwAAAACAAAAAAAACSmwCQAETAAAAAIAAAAAAAAJKp0FAAAAA25pbAkABEwAAAACCQAETAAAAAIAAAAAAAAGUfUJAARMAAAAAgAAAAAAAAZSLQUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMUJpYXNlcwkABEwAAAACAP///////AwWCQAETAAAAAIA///////2TQsFAAAAA25pbAAAAAANbGF5ZXIyV2VpZ2h0cwkABEwAAAACCQAETAAAAAIAAAAAAAAMtcYJAARMAAAAAgD///////JPiwUAAAADbmlsBQAAAANuaWwAAAAADGxheWVyMkJpYXNlcwkABEwAAAACAP//////+i8FBQAAAANuaWwBAAAABHJlbHUAAAABAAAAAXgDCQAAZgAAAAIFAAAAAXgAAAAAAAAAAAAFAAAAAXgAAAAAAAAAAAABAAAADnNpZ21vaWRfYXBwcm94AAAAAQAAAAF4AwkAAGYAAAACAP///////+x4BQAAAAF4AAAAAAAAAAAAAwkAAGYAAAACAAAAAAAAAAAABQAAAAF4AA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AAAAAAAAAAAAAEAAAABaQEAAAAHcHJlZGljdAAAAAIAAAAGaW5wdXQxAAAABmlucHV0MgQAAAAGaW5wdXRzCQAETAAAAAIFAAAABmlucHV0MQkABEwAAAACBQAAAAZpbnB1dDIFAAAAA25pbAQAAAAKcHJlZGljdGlvbgkBAAAAC2ZlZWRmb3J3YXJkAAAAAQUAAAAGaW5wdXRzCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAApwcmVkaWN0aW9uBQAAAApwcmVkaWN0aW9uBQAAAANuaWwAAAAA1WWv/g==",
"height": 3091156,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 4Y5WL8dQqwHHtb9Ei4jYd9217YqLbJ62uGymgyngzKKK
Next: HQYVbfLQm6q7Et1MgYX3SjNGapVKGrrmzK5duBWV2fLi
Diff:
Old | New | | Differences |
---|
14 | 14 | | else 0 |
---|
15 | 15 | | |
---|
16 | 16 | | |
---|
| 17 | + | func sigmoid_approx (x) = if ((-5000 > x)) |
---|
| 18 | + | then 0 |
---|
| 19 | + | else if ((0 > x)) |
---|
| 20 | + | then 5000 |
---|
| 21 | + | else if ((5000 > x)) |
---|
| 22 | + | then 9500 |
---|
| 23 | + | else 10000 |
---|
| 24 | + | |
---|
| 25 | + | |
---|
17 | 26 | | func dotProduct (v1,v2) = { |
---|
18 | 27 | | let sum1 = ((v1[0] * v2[0]) / 10000) |
---|
19 | 28 | | let sum2 = ((v1[1] * v2[1]) / 10000) |
---|
|
22 | 31 | | |
---|
23 | 32 | | |
---|
24 | 33 | | func feedforward (inputs) = { |
---|
25 | | - | let layer1Result1 = relu((dotProduct(inputs, layer1Weights[0]) + layer1Biases[0])) |
---|
26 | | - | let layer1Result2 = relu((dotProduct(inputs, layer1Weights[1]) + layer1Biases[1])) |
---|
| 34 | + | let layer1Result1 = sigmoid_approx((dotProduct(inputs, layer1Weights[0]) + layer1Biases[0])) |
---|
| 35 | + | let layer1Result2 = sigmoid_approx((dotProduct(inputs, layer1Weights[1]) + layer1Biases[1])) |
---|
27 | 36 | | let layer2Inputs = [layer1Result1, layer1Result2] |
---|
28 | | - | (dotProduct(layer2Inputs, layer2Weights[0]) + layer2Biases[0]) |
---|
| 37 | + | sigmoid_approx((dotProduct(layer2Inputs, layer2Weights[0]) + layer2Biases[0])) |
---|
29 | 38 | | } |
---|
30 | 39 | | |
---|
31 | 40 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let layer1Weights = [[600496, 600733], [414197, 414253]] |
---|
5 | 5 | | |
---|
6 | 6 | | let layer1Biases = [-259050, -635637] |
---|
7 | 7 | | |
---|
8 | 8 | | let layer2Weights = [[832966, -897141]] |
---|
9 | 9 | | |
---|
10 | 10 | | let layer2Biases = [-381179] |
---|
11 | 11 | | |
---|
12 | 12 | | func relu (x) = if ((x > 0)) |
---|
13 | 13 | | then x |
---|
14 | 14 | | else 0 |
---|
15 | 15 | | |
---|
16 | 16 | | |
---|
| 17 | + | func sigmoid_approx (x) = if ((-5000 > x)) |
---|
| 18 | + | then 0 |
---|
| 19 | + | else if ((0 > x)) |
---|
| 20 | + | then 5000 |
---|
| 21 | + | else if ((5000 > x)) |
---|
| 22 | + | then 9500 |
---|
| 23 | + | else 10000 |
---|
| 24 | + | |
---|
| 25 | + | |
---|
17 | 26 | | func dotProduct (v1,v2) = { |
---|
18 | 27 | | let sum1 = ((v1[0] * v2[0]) / 10000) |
---|
19 | 28 | | let sum2 = ((v1[1] * v2[1]) / 10000) |
---|
20 | 29 | | (sum1 + sum2) |
---|
21 | 30 | | } |
---|
22 | 31 | | |
---|
23 | 32 | | |
---|
24 | 33 | | func feedforward (inputs) = { |
---|
25 | | - | let layer1Result1 = relu((dotProduct(inputs, layer1Weights[0]) + layer1Biases[0])) |
---|
26 | | - | let layer1Result2 = relu((dotProduct(inputs, layer1Weights[1]) + layer1Biases[1])) |
---|
| 34 | + | let layer1Result1 = sigmoid_approx((dotProduct(inputs, layer1Weights[0]) + layer1Biases[0])) |
---|
| 35 | + | let layer1Result2 = sigmoid_approx((dotProduct(inputs, layer1Weights[1]) + layer1Biases[1])) |
---|
27 | 36 | | let layer2Inputs = [layer1Result1, layer1Result2] |
---|
28 | | - | (dotProduct(layer2Inputs, layer2Weights[0]) + layer2Biases[0]) |
---|
| 37 | + | sigmoid_approx((dotProduct(layer2Inputs, layer2Weights[0]) + layer2Biases[0])) |
---|
29 | 38 | | } |
---|
30 | 39 | | |
---|
31 | 40 | | |
---|
32 | 41 | | @Callable(i) |
---|
33 | 42 | | func predict (input1,input2) = { |
---|
34 | 43 | | let inputs = [input1, input2] |
---|
35 | 44 | | let prediction = feedforward(inputs) |
---|
36 | 45 | | [IntegerEntry("prediction", prediction)] |
---|
37 | 46 | | } |
---|
38 | 47 | | |
---|
39 | 48 | | |
---|