jeudi 6 juillet 2023

Extract pattern from Machine learning model

have created an ML model for a sports betting dataset, and its accuracy is 90%. The dataset contains the following column names:

python Copy code ['League', 'Time', 'Hour', 'Minute', 'TeamA', 'TeamB', 'Result', 'Result_FinalTime', 'Result_HalfTime', 'Odds', 'Odd', 'FirstTeamToScore', 'LastTeamToScore', 'Winner_HT_FT', 'Result_HalfTime_Odd', 'Id', 'timedelta', 'timestamp', 'Data', 'HomeTeamWin', 'AwayTeamWin', 'Day', 'BothTeamToScore', 'BothTeamToNotScore', 'BothTeamToScoreAndOver2.5', 'under_1_5', 'under_2_5', 'under_3_5', '2GoalsExactly', '3GoalsExactly', '5GoalsOrMore', 'BothTeamsToScoreHalfTime', 'Over1.5HalfTime', 'DrawFinalTime', 'HomeTeamWinsHalfTime', 'AwayTeamWinsHalfTime', '1-1FinalTime', 'DrawHalfTime', 'HomeTeamWin2-0', 'AwayTeamToScore', 'over_1_5', 'over_2_5', 'over_3_5', 'under_0_5', 'total_gols', 'ambas_marcam_odd', 'over_1_5_odds', 'over_2_5_odd', 'over_3_5_odd', 'Home', 'Away', 'team1_score', 'team2_score', 'y'] I want to create patterns based on the following conditions:

Over 3.5 (more than 3 goals):

Sample: 3404 Successful: 764 Unsuccessful: 2640 Martingale needed: 2 times (Maximum 2) Success rate: 22.444183313748532% Description: After a match with more than 3 goals, place a bet on Over 3.5 goals. Under 1.5 (1 or fewer goals):

Sample: 3404 Successful: 754 Unsuccessful: 2650 Martingale needed: 2 times (Maximum 2) Success rate: 22.150411280846065% Description: After a match with 1 or fewer goals, place a bet on Under 1.5 goals. Under 2.5 (2 or fewer goals):

Sample: 3404 Successful: 1669 Unsuccessful: 1735 Martingale needed: 2 times (Maximum 2) Success rate: 49.030552291421856% Description: After a match with 2 or fewer goals, place a bet on Under 2.5 goals. Martingale can be from 0-2. I have prepared the feature matrix X and the target variable y as follows:

python Copy code import pandas as pd from sklearn.model_selection import train_test_split

Prepare the feature matrix X and the target variable y

X = data[['League', 'Hour', 'Minute', 'HomeTeamWin', 'AwayTeamWin', 'over_1_5', 'over_2_5', 'over_3_5', 'under_1_5', 'under_2_5', 'under_3_5']] # Adjust the column names as per your dataset y = data['y']

Split the dataset into training and testing sets

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

Initialize the XGBoost classifier

model = XGBClassifier() # Replace with the appropriate classifier

Fit the model on the training data

model.fit(X_train, y_train)

Evaluate the model on the training set

train_success_rate = model.score(X_train, y_train) * 100

Evaluate the model on the test set

test_success_rate = model.score(X_test, y_test) * 100

print(f"Training Success rate: {train_success_rate}%") print(f"Test Success rate: {test_success_rate}%")

I want to find patterns in the dataset using this model. Can anyone please help me with this?


python Copy code ['League', 'Time', 'Hour', 'Minute', 'TeamA', 'TeamB', 'Result', 'Result_FinalTime', 'Result_HalfTime', 'Odds', 'Odd', 'FirstTeamToScore', 'LastTeamToScore', 'Winner_HT_FT', 'Result_HalfTime_Odd', 'Id', 'timedelta', 'timestamp', 'Data', 'HomeTeamWin', 'AwayTeamWin', 'Day', 'BothTeamToScore', 'BothTeamToNotScore', 'BothTeamToScoreAndOver2.5', 'under_1_5', 'under_2_5', 'under_3_5', '2GoalsExactly', '3GoalsExactly', '5GoalsOrMore', 'BothTeamsToScoreHalfTime', 'Over1.5HalfTime', 'DrawFinalTime', 'HomeTeamWinsHalfTime', 'AwayTeamWinsHalfTime', '1-1FinalTime', 'DrawHalfTime', 'HomeTeamWin2-0', 'AwayTeamToScore', 'over_1_5', 'over_2_5', 'over_3_5', 'under_0_5', 'total_gols', 'ambas_marcam_odd', 'over_1_5_odds', 'over_2_5_odd', 'over_3_5_odd', 'Home', 'Away', 'team1_score', 'team2_score', 'y'] I want to create patterns based on the following conditions:

Over 3.5 (more than 3 goals):

Sample: 3404 Successful: 764 Unsuccessful: 2640 Martingale needed: 2 times (Maximum 2) Success rate: 22.444183313748532% Description: After a match with more than 3 goals, place a bet on Over 3.5 goals. Under 1.5 (1 or fewer goals):

Sample: 3404 Successful: 754 Unsuccessful: 2650 Martingale needed: 2 times (Maximum 2) Success rate: 22.150411280846065% Description: After a match with 1 or fewer goals, place a bet on Under 1.5 goals. Under 2.5 (2 or fewer goals):

Sample: 3404 Successful: 1669 Unsuccessful: 1735 Martingale needed: 2 times (Maximum 2) Success rate: 49.030552291421856% Description: After a match with 2 or fewer goals, place a bet on Under 2.5 goals. Martingale can be from 0-2. I have prepared the feature matrix X and the target variable y as follows:

python Copy code import pandas as pd from sklearn.model_selection import train_test_split

Prepare the feature matrix X and the target variable y

X = data[['League', 'Hour', 'Minute', 'HomeTeamWin', 'AwayTeamWin', 'over_1_5', 'over_2_5', 'over_3_5', 'under_1_5', 'under_2_5', 'under_3_5']] # Adjust the column names as per your dataset y = data['y']

Split the dataset into training and testing sets

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

Initialize the XGBoost classifier

model = XGBClassifier() # Replace with the appropriate classifier

Fit the model on the training data

model.fit(X_train, y_train)

Evaluate the model on the training set

train_success_rate = model.score(X_train, y_train) * 100

Evaluate the model on the test set

test_success_rate = model.score(X_test, y_test) * 100

print(f"Training Success rate: {train_success_rate}%") print(f"Test Success rate: {test_success_rate}%")

I want to find patterns in the dataset using this model. Can anyone please help me with this?


Aucun commentaire:

Enregistrer un commentaire