Negative contributions.
This commit is contained in:
parent
8826d77647
commit
66c24a172d
|
@ -78,13 +78,13 @@ def probabilities():
|
||||||
prediction["night"] = not prediction["night"]
|
prediction["night"] = not prediction["night"]
|
||||||
|
|
||||||
# Calculate contributions of predictions
|
# Calculate contributions of predictions
|
||||||
consensus_weight_sum = sum(p["weight"] for p in predictions if p["night"] == night)
|
weight_sum = sum(p["weight"] for p in predictions)
|
||||||
for prediction in predictions:
|
for prediction in predictions:
|
||||||
# If this prediction agrees with the consensus it contributed
|
prediction["contribution"] = prediction["weight"] / weight_sum
|
||||||
if prediction["night"] == night:
|
|
||||||
prediction["contribution"] = prediction["weight"] / consensus_weight_sum
|
# If this prediction disagrees with the consensus it contributed negatively
|
||||||
else:
|
if prediction["night"] != night:
|
||||||
prediction["contribution"] = 0.0
|
prediction["contribution"] *= -1
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"predictions": predictions,
|
"predictions": predictions,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user