betbot.prediction package¶
Submodules¶
betbot.prediction.BettingOddsPredictor module¶
- class betbot.prediction.BettingOddsPredictor.BettingOddsPredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.Predictor.Predictor
Class that determinalistically predicts matches based on Tipico quotes
- generate_scores(home_odds: float, draw_odds: float, away_odds: float) Tuple[int, int] ¶
Generates a scoreline based on the quote data :param home_odds: The odds that the home team wins :param draw_odds: The odds that the match ends in a draw :param away_odds: The odds that the away team wins :return: The generated bet
- classmethod name() str ¶
- Returns
The name of the predictor
- predict(matches: List[betbot.api.Match.Match]) List[betbot.api.Bet.Bet] ¶
Performs the prediction :param matches: The matches to predict :return: The predictions as Bet objects
betbot.prediction.DrawPredictor module¶
- class betbot.prediction.DrawPredictor.DrawPredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.Predictor.Predictor
Class that always predicts 0:0, 1:1, 2:2 or 3:3
- classmethod name() str ¶
- Returns
The name of the predictor
- predict(matches: List[betbot.api.Match.Match]) List[betbot.api.Bet.Bet] ¶
Performs the prediction :param matches: The matches to predict :return: The predictions as Bet objects
betbot.prediction.HomeTeamPredictor module¶
- class betbot.prediction.HomeTeamPredictor.HomeTeamPredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.Predictor.Predictor
Class that always predicts 2:1 for the home team
- classmethod name() str ¶
- Returns
The name of the predictor
- predict(matches: List[betbot.api.Match.Match]) List[betbot.api.Bet.Bet] ¶
Performs the prediction :param matches: The matches to predict :return: The predictions as Bet objects
betbot.prediction.LeagueTablePredictor module¶
- class betbot.prediction.LeagueTablePredictor.LeagueTablePredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.Predictor.Predictor
Class that always 2:1 for the team higher up in the league table
- classmethod name() str ¶
- Returns
The name of the predictor
- predict(matches: List[betbot.api.Match.Match]) List[betbot.api.Bet.Bet] ¶
Performs the prediction :param matches: The matches to predict :return: The predictions as Bet objects
betbot.prediction.NameAndOddsPredictor module¶
- class betbot.prediction.NameAndOddsPredictor.NameAndOddsPredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.SKLearnPredictor.SKLearnPredictor
scikit-learn powered predictor that uses the name and betting odds
- interpret_results(home_result: float, away_result: float) Tuple[int, int] ¶
Interprets the raw results :param home_result: The home goals result :param away_result: The away goals result :return: The home goals, the away goals
- classmethod name() str ¶
- Returns
The name of the predictor
betbot.prediction.NamePredictor module¶
- class betbot.prediction.NamePredictor.NamePredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.SKLearnPredictor.SKLearnPredictor
scikit-learn powered predictor that uses only the team names
- encode_result(home_score: int, away_score: int) numpy.ndarray ¶
Encodes a result vector This is done as a normalization step. :param home_score: The home score to encode :param away_score: The away score to encode :return: The encoded result vector
- interpret_results(home_result: float, away_result: float) Tuple[int, int] ¶
Interprets the raw results :param home_result: The home goals result :param away_result: The away goals result :return: The home goals, the away goals
- classmethod name() str ¶
- Returns
The name of the predictor
- predict_match(match: betbot.api.Match.Match) Optional[Tuple[int, int]] ¶
Predicts the result of a single match using the trained model :param match: The match to predict :return: The home goals and away goals or None
if no prediction took place
- vectorize(match_data: Dict[str, Union[str, float]]) numpy.ndarray ¶
Defines how a match is vectorized :param match_data: The match data to vectorize :return: The vector for the match
betbot.prediction.Predictor module¶
- class betbot.prediction.Predictor.Predictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
object
Class that specifies required methods for predictor objects
- __init__(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Initializes the model directory if it does not exist :param api: The bundesliga-tippspiel API connection :param league: The league for which to predict matches :param season: The season for which to predict matches
- classmethod name() str ¶
- Returns
The name of the predictor
- predict(matches: List[betbot.api.Match.Match]) List[betbot.api.Bet.Bet] ¶
Performs the prediction :param matches: The matches to predict :return: The predictions as Bet objects
betbot.prediction.RandomPredictor module¶
- class betbot.prediction.RandomPredictor.RandomPredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.Predictor.Predictor
Class that always predicts random results
- classmethod name() str ¶
- Returns
The name of the predictor
- predict(matches: List[betbot.api.Match.Match]) List[betbot.api.Bet.Bet] ¶
Performs the prediction :param matches: The matches to predict :return: The predictions as Bet objects
betbot.prediction.SKLearnPredictor module¶
- class betbot.prediction.SKLearnPredictor.SKLearnPredictor(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Bases:
betbot.prediction.Predictor.Predictor
Abstract class that defines how a scikit-learn-based predictor should operate
- __init__(api: betbot.api.ApiConnection.ApiConnection, league: str, season: int)¶
Initializes the scikit-learn model :param api: The bundesliga-tippspiel API connection :param league: The league for which to predict matches :param season: The season for which to predict matches
- encode_result(home_score: int, away_score: int) numpy.ndarray ¶
Encodes a result vector This is done as a normalization step. :param home_score: The home score to encode :param away_score: The away score to encode :return: The encoded result vector
- interpret_results(home_result: float, away_result: float) Tuple[int, int] ¶
Interprets the raw results :param home_result: The home goals result :param away_result: The away goals result :return: The home goals, the away goals
- property odds: Dict[Tuple[str, str], Tuple[float, float, float]]¶
Retrieves current odds using a mix of football-data.co.uk and oddsportal.com :return: The odds for each match in the selected league
- predict(matches: List[betbot.api.Match.Match]) List[betbot.api.Bet.Bet] ¶
Performs the prediction :param matches: The matches to predict :return: The predictions as Bet objects
- predict_match(match: betbot.api.Match.Match) Optional[Tuple[int, int]] ¶
Predicts the result of a single match using the trained model :param match: The match to predict :return: The home goals and away goals or None
if no prediction took place
- classmethod regressor() sklearn.neural_network._multilayer_perceptron.MLPRegressor ¶
Defines the regressor used during the prediction process :return: The predictor
- train()¶
Trains the prediction model
- vectorize(match_data: Dict[str, Union[str, float]]) numpy.ndarray ¶
Defines how a match is vectorized :param match_data: The match data to vectorize :return: The vector for the match