From 34cfa66252d51e3ff74af70f43027794ddc1090c Mon Sep 17 00:00:00 2001 From: s487194 Date: Tue, 23 Jan 2024 23:43:00 +0100 Subject: [PATCH] Last 5 matches between teams added to data_filters, fix fuzzy rules for shots --- data_filters.py | 7 +++++++ rules.py | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/data_filters.py b/data_filters.py index 2f13b93..ff1e195 100644 --- a/data_filters.py +++ b/data_filters.py @@ -29,6 +29,13 @@ def last5Matches(season, teamA, data, df): return last_before_date +def last5MatchesBtwTeams(teamA, teamB, data, df): + subset = df[(((df['home_team'] == teamA) | (df['away_team'] == teamA)) & ((df['home_team'] == teamB) | (df['away_team'] == teamB)))] + before_given_date = subset[pd.to_datetime(subset['date']) < pd.to_datetime(data)] + before_given_date = before_given_date.sort_values(by='date', ascending=False) + last_before_date = before_given_date.head(5) + + return last_before_date def seasonMatches(season, teamA, data, df): # Wybierz rekordy dla danej pary drużyn i sezonu diff --git a/rules.py b/rules.py index 000489f..bc448a4 100644 --- a/rules.py +++ b/rules.py @@ -104,13 +104,13 @@ def categorize_fuzzy_shots(shots_overall, shots_on_target): "IF (shots_overall IS high ) AND (shots_on_target IS low) THEN (quality_of_shots IS low)", - "IF (shots_overall IS average) AND (possession IS high) THEN (quality_of_shots IS high)", + "IF (shots_overall IS average) AND (shots_on_target IS high) THEN (quality_of_shots IS high)", - "IF (passes IS high) AND (possession IS average) THEN (quality_of_shots IS high)", + "IF (shots_overall IS high) AND (shots_on_target IS average) THEN (quality_of_shots IS average)", - "IF (passes IS low) AND (possession IS average) THEN (quality_of_shots IS low)", + "IF (shots_overall IS low) AND (shots_on_target IS average) THEN (quality_of_shots IS average)", - "IF (passes IS average) AND (possession IS low) THEN (quality_of_shots IS average)" + "IF (shots_overall IS average) AND (shots_on_target IS low) THEN (quality_of_shots IS low)" ])