Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""LICENSE
2Copyright 2020 Hermann Krumrey <hermann@krumreyh.com>
4This file is part of betbot.
6betbot is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
11betbot is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
16You should have received a copy of the GNU General Public License
17along with betbot. If not, see <http://www.gnu.org/licenses/>.
18LICENSE"""
20from typing import Tuple
21from betbot.prediction.SKLearnPredictor import SKLearnPredictor
24class NameAndOddsPredictor(SKLearnPredictor):
25 """
26 scikit-learn powered predictor that uses the name and betting odds
27 """
29 @classmethod
30 def name(cls) -> str:
31 """
32 :return: The name of the predictor
33 """
34 return "name-and-odds"
36 # noinspection PyMethodMayBeStatic
37 def interpret_results(self, home_result: float, away_result: float) -> \
38 Tuple[int, int]:
39 """
40 Interprets the raw results
41 :param home_result: The home goals result
42 :param away_result: The away goals result
43 :return: The home goals, the away goals
44 """
45 min_score = min([home_result, away_result])
46 normer = round(min_score)
47 home_score = round(home_result - min_score + normer)
48 away_score = round(away_result - min_score + normer)
49 if home_score == away_score:
50 if min_score == home_result:
51 away_score += 1
52 else:
53 home_score += 1
55 return home_score, away_score