Commit 3862e287 authored by Hermann Krumrey's avatar Hermann Krumrey

Merge branch 'develop' into 'master'

Fix xvfb-related issues

See merge request !6
parents 870fd4d8 46eb4530
V 0.5.1:
- Fixed xvfb-related issues
V 0.5.0:
- Gives neural network more data
V 0.4.0:
......
......@@ -10,4 +10,4 @@ ADD . bot
RUN cd bot && python3 setup.py install
WORKDIR bot
CMD ["xvfb-run", "multi-betbot", "-v"]
CMD ["docker_start.sh", "-v"]
......@@ -19,11 +19,13 @@ LICENSE"""
import os
import csv
import time
import requests
import dryscrape
from datetime import datetime
from io import StringIO
from bs4 import BeautifulSoup
from webkit_server import InvalidResponseError
from typing import List, Tuple, Dict, Optional
from betbot.neural.data.vector.InputVector import InputVector
from betbot.neural.data.vector.OutputVector import OutputVector
......@@ -154,7 +156,19 @@ class FootballDataFetcher(DataFetcher):
]
current_matches = [x for x in _current_matches if x is not None]
if len(current_matches) == 0:
current_matches = self.load_oddsportal_matches()
retry = 0
while retry < 3:
retry += 1
try:
current_matches = self.load_oddsportal_matches()
except InvalidResponseError:
self.logger.warning("Failed to fetch data from oddsportal")
if retry < 3:
self.logger.info("Retrying...")
time.sleep(15)
else:
self.logger.warning("Couldn't fetch data")
return []
_all_matches = [
Match.from_football_data(x)
......
......@@ -47,7 +47,6 @@ class BetPredictorTrainer(Trainer):
for i, expected in enumerate(expected_output):
predicted = [float(round(x)) for x in predictions[i]]
print(f"{predicted}|{expected}|{predictions[i]}")
if int(predicted[0]) == int(predicted[1]):
draws += 1
......@@ -72,7 +71,11 @@ class BetPredictorTrainer(Trainer):
score = points / len(predictions)
accuracy = 100 * score / 15
print(f"Winner Accuracy: {100 * correct_winners / len(predictions)}%")
print(f"Correct Accuracy: {100 * correct_results / len(predictions)}%")
print(f"Draw Percentage: {100 * draws / len(predictions)}%")
self.logger.info(f"Winner Accuracy: "
f"{100 * correct_winners / len(predictions)}%")
self.logger.info(f"Correct Accuracy: "
f"{100 * correct_results / len(predictions)}%")
self.logger.info(f"Draw Percentage: "
f"{100 * draws / len(predictions)}%")
self.logger.info(f"Average Points: {score} ({accuracy}%)")
return score, accuracy
......@@ -40,7 +40,7 @@ class TableHistoryNNPredictor(Predictor):
super().__init__()
self.model_data_path = os.path.join(self.model_dir, self.name())
trainer = MatchHistoryTrainer(self.model_data_path)
self.model = trainer.load_trained_model(minimum_accuracy=41.0)
self.model = trainer.load_trained_model(minimum_accuracy=41.5)
@classmethod
def name(cls) -> str:
......
#!/bin/bash
Xvfb :00 &
export DISPLAY=:00
multi-betbot "$@"
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
0.5.0
\ No newline at end of file
0.5.1
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment