Merge and stuff.
This commit is contained in:
parent
21fa94bade
commit
9bce7205d8
|
@ -12,6 +12,7 @@ source venv/bin/activate
|
|||
echo Installing required Python packages
|
||||
pip install -Ur requirements.txt
|
||||
|
||||
|
||||
function run() {
|
||||
python -m nightr
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ from typing import List
|
|||
import requests_cache
|
||||
from flask import Flask, jsonify
|
||||
|
||||
from strategies import dmi, steam, miloStrats
|
||||
import Context
|
||||
from server.nightr.strategies import dmi, steam, miloStrats
|
||||
from server.nightr.util import Context
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
@ -19,8 +19,8 @@ strategies = {
|
|||
# name: (weight, probability function)
|
||||
"dmi": (0.5, dmi.probability),
|
||||
"steam": (1.0, steam.probability),
|
||||
"australia" : (0.5, miloStrats.australiaStrat),
|
||||
"camera" : (0.5, miloStrats.camImgStrat),
|
||||
"australia": (1.0, miloStrats.australiaStrat),
|
||||
"camera": (1.0, miloStrats.camImgStrat),
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,6 +49,12 @@ def probabilities():
|
|||
median = statistics.median(p["weighted_probability"] for p in predictions)
|
||||
night = mean > 0.5
|
||||
|
||||
# Invert if we're in Australia
|
||||
if context.in_australia:
|
||||
night = not night
|
||||
for prediction in predictions:
|
||||
prediction["night"] = not prediction["night"]
|
||||
|
||||
# Calculate contributions of predictions
|
||||
consensus_weight_sum = sum(p["weight"] for p in predictions if p["night"] == night)
|
||||
for prediction in predictions:
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import requests
|
||||
from datetime import datetime
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def main():
|
||||
filename = "dotaplayers " + str(datetime.now()) + ".csv"
|
||||
|
@ -16,5 +18,6 @@ def main():
|
|||
f.close()
|
||||
time.sleep(100)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,6 +1,8 @@
|
|||
from datetime import datetime
|
||||
|
||||
import cv2
|
||||
from datetime import datetime, timedelta
|
||||
from pytz import timezone
|
||||
|
||||
from server.nightr.util import Context, Prediction
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
from dataclasses import dataclass, field
|
||||
from typing import List, Tuple
|
||||
from typing import List, Dict
|
||||
|
||||
|
||||
@dataclass
|
||||
class Context:
|
||||
battery: float = 1.0
|
||||
coordinates: Tuple[float, float] = (0.0, 0.0)
|
||||
battery: float
|
||||
position: Dict[str, float] # {'latitude': '23.2583', 'longitude': '154.0417'}
|
||||
|
||||
# App settings
|
||||
in_australia: bool = False
|
||||
flat_earth: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
Flask==1.0.2
|
||||
requests==2.21.0
|
||||
requests-cache==0.4.13
|
||||
pytz
|
||||
pytz
|
||||
beautifulsoup4
|
||||
pandas
|
||||
opencv-python
|
||||
|
|
Loading…
Reference in a new issue