The `list[float]` is an example of a subscripted type.
The `list[float]` is an example of a subscripted type. Python 3.9 should also work but 3.10 is the version Lem is using for development.
The exact error you get before upgrading Python is:
`builtins.TypeError: 'type' object is not subscriptable`
Also had to `pip install loguru` in my Python 3.10. This is not critical because you can always just remove the logging (line 105 in the interface -- algorithms.py XXX).
Also had to `pip install loguru` in my Python 3.10. This is not critical because you can always just remove the logging (a single line in the algorithms.py code).
Thereafter everything worked fine. This discussion will now focus on the details of integrating custom algorithms (custom_algo.py) with the interface (algorithms.py).
...
...
@@ -62,9 +62,9 @@ class AlgorithmOutput:
intermediate_results:list
```
Calculations now proceed with the input `intermediate_results` and result in new output `intermediate_results` which then become the input to the next level. Of course, the calculated OpinionData, which is what is actually of interest to the user, is also produced.
Calculations now proceed with the input `intermediate_results` and result in new output `intermediate_results` which then become the input to the next level. Of course, the calculated `OpinionData`, which is what is actually of interest to the user, is also produced.
In essence, for the case of straight averaging, the `intermediate_results` are just the Sapienza trust-modified probabilities of every source in the sub-group to be analyzed. The sub-group in this case is a node and its direct descendants (children). The average of the group is calculated and the list of probabilities (modified by trust) become the results for the next level. Two examples of a multi-level tree were created manually to test this concept (just run custom_algo.py). In real life transferring results between nodes will presumably be handled by the server code, so this is really just an experiment to see that things are conceptually ok.
In essence, for the case of straight averaging, the `intermediate_results` are just the Sapienza trust-modified probabilities of every source in the sub-group to be analyzed. The sub-group in this case is a node and its direct descendants (children). The average of the group is calculated and that plus the list of probabilities (modified by trust) become the results for the next level. Two examples of a multi-level tree were created manually to test this concept (just run custom_algo.py). In real life transferring results between nodes will presumably be handled by the server code, so this is really just an experiment to see that things are conceptually ok.
<h2>Example of using straight_average_intermediate</h2>
...
...
@@ -169,3 +169,6 @@ We don't need to do this since we're done but if Node 0 were to require transmis
Running the snippet XXX for this case gives an overall $P_{ave} = 0.616$, same as in [A-simple-averaging-technique-to-supplement-the-Bayes-equation](A-simple-averaging-technique-to-supplement-the-Bayes-equation).