{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.style\nmatplotlib.style.use(\"ggplot\")\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n        \nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport numpy as np\nimport plotly.express as px  \nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn import metrics\nfrom sklearn.metrics import classification_report\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-11-10T11:33:59.799478Z","iopub.execute_input":"2022-11-10T11:33:59.799920Z","iopub.status.idle":"2022-11-10T11:33:59.816127Z","shell.execute_reply.started":"2022-11-10T11:33:59.799886Z","shell.execute_reply":"2022-11-10T11:33:59.814855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"padding:20px;color:black;margin:0;font-size:250%;text-align:center;display:fill;border-radius:5px;background-color:#aaf0f0;overflow:hidden;font-weight:700;border: 5px solid #21a3a3;\"> Best Jockey Strategy Analysis</div>","metadata":{}},{"cell_type":"markdown","source":"### Introduction\n* In this work, we will analyze the data relating to the **Best Jockey**, data concerning the parameters of the races in which the best jockey participated as well as the races he performed.\n### Objectif\n* The main objective of this work is to try to **identify the strategy or strategies** of the **Best Jockey**, a strategy involving **the choice of races** and the **tactics** of the jokey during the races he will have performed.\nWe will therefore try **to answer** an important question: **How is this jockey the best?!**\n\n### Methodology\n* As previously mentioned above, we will analyze the data relating to the choice of races as well as those relating to the behavior of the best jockey during the race, so our study will be divided into the following parts, namely:\n\n### 1.Designation of the overall ranking of the best jockeys\n* The first step of the work is the designation of the best jockeys, it’s naturally done based on the totality of the winnings (purses) pocketed during all the races, it was therefore necessary to determine the classification of each jockey during these races and thus to determine the winnings (purses) pocketed in each position during each race.\n\nThe **classification** or **position** and the **purses** during a race of jockeys are extracted from the site: https://www.equibase.com, and are the same provided by Kaggle (in the 9/8/22).\n\nAfter determining the overall ranking of the jockeys on the basis of all the **winnings (purses)** pocketed by each of them, the best jockey will be the ones that have the biggest pocketed total purses.\n\n###  2.Best Jockey Courses Participations and Performaces Analysis\n* This part of the work will aim to carry out an exploratory analysis of data relating to the races carried out by the best jockey and to extract useful information about :\n* A) how did the best jockey choose his races ?\n* B) Were his choices wise and judicious ?\n\n###  3. Race Choice Strategy Effectiveness Prediction\n* Based on the analysis of the best jockey data related the his choices of races, we will establish a statistical model, in order to test and predict the effictiveness of the best jockey choice strategies.\n\n###  4. Race analysis of the best jockey\n* After analyzing the choices of the best jockey and highlighting a race choice strategy for this jockey and also building a model for predicting his final position during the races, based on few assumption, we will try to analyze the data relating to the races themselves. the purpose is to analyze **the behavior of the best jockey in his races**, and therefore answer the following question:\n* Does this jockey have a particular **behavior** or **strategy** during his races, especially those he has won?\n\n","metadata":{"_kg_hide-input":true}},{"cell_type":"markdown","source":"<div style=\"padding:10px;color:blue;margin:0;font-size:150%;text-align:center;display:fill;border-radius:3px;background-color:#aaf0f0;overflow:hidden;font-weight:700;border: 5px solid #21a3a3;\"> 1. Designation of the overall ranking of the best jockeys</div>","metadata":{}},{"cell_type":"markdown","source":"### 1. Designation of the overall ranking of the best jockeys","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"markdown","source":"**Introduction** \n\n* As previously advised, it is necessary to determine the best jockey in order to be able to study these performances, his race strategy and predict his position.\n\n* To do this, we will start by collecting the necessary data from the site https://www.equibase.com/, namely the position of each jockey and the value of the purse he will have won in each race in which he participated.","metadata":{}},{"cell_type":"markdown","source":"### 1. The Data\n\nAs previously advised, we retrieved the positions and earnings won by each jockey during each race on the site: https://www.equibase.com/.\n\n","metadata":{}},{"cell_type":"code","source":"data = pd.read_excel('../input/jockey-position-purse/Jockey_Position_Purse.xlsx') \ndata.info()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:33:59.818354Z","iopub.execute_input":"2022-11-10T11:33:59.818992Z","iopub.status.idle":"2022-11-10T11:34:03.144726Z","shell.execute_reply.started":"2022-11-10T11:33:59.818955Z","shell.execute_reply":"2022-11-10T11:34:03.143275Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### 2. Total Purses by Jockey and Ranking \n\n* The designation of the best jockey on the basis of the **total earnings** (purses) won by each jockey during each race,will be done using the collected data, it will be  followed by a ranking in descending order.\n* In order to calculate the purses by jockey in each race, a small application named : **Global** is coded to be able to calculate the total earnings of the jockeys, this application will also be used in the remaining notebook each time we need to calculate a total within a cross tabulation.","metadata":{}},{"cell_type":"code","source":"def Global (A,B):\n    n=len(A);m=len(B)\n    for j in range(m+1):\n        for i in range(n+1):\n            A[i-1:i,j-1:j]=A[i-1:i,j-1:j]*B[j-1:j,]\n    return(A)","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:03.146896Z","iopub.execute_input":"2022-11-10T11:34:03.147774Z","iopub.status.idle":"2022-11-10T11:34:03.155210Z","shell.execute_reply.started":"2022-11-10T11:34:03.147723Z","shell.execute_reply":"2022-11-10T11:34:03.154430Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cros=pd.crosstab(data.jockey,data.pursebyjokey)  ## build the cross tabulation between the jockey and the purses values\ncrosmat=cros.to_numpy() ## convert the dataframe cross tabulation to a numphy table or matrix.\npurses=list(cros.columns.values) ## obtain the purses values related to each race position.\npursesjk= np.array(purses)## convert the purses values related to each race position to and array.\nA=crosmat \nB=pursesjk\nP=Global (A,B) \nF= pd.DataFrame(P)  \nS=F.sum(axis=1)  \nname=data.loc[:,['jockey']] \nname=name.sort_values(by=['jockey']) \nname=name.value_counts() \nname=name.sort_index(axis = 0, ascending = True) \nwiner=name.index.to_list() \nwin= np.array(winer) \nFwin= pd.DataFrame(win) \nSwin= pd.DataFrame(S) \nFwin.columns = ['Jockey']\nSwin.columns = ['Jockey_Total_Purse'] \nresult= pd.concat([Fwin,Swin], axis=1) \nBestJokey=result.sort_values(by=['Jockey_Total_Purse'],ascending=False)\nBestJokey=BestJokey.reset_index() \ndel BestJokey['index']\nBestJokey.index += 1\nBestJokey10=BestJokey.head(10)\nBestJokey10## The Best Ten Jockey","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-11-10T11:34:03.157731Z","iopub.execute_input":"2022-11-10T11:34:03.158165Z","iopub.status.idle":"2022-11-10T11:34:03.826586Z","shell.execute_reply.started":"2022-11-10T11:34:03.158123Z","shell.execute_reply":"2022-11-10T11:34:03.825448Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"figBest10 = px.bar(BestJokey10,x=\"Jockey\", y = \"Jockey_Total_Purse\",color=\"Jockey_Total_Purse\",title=\"First Ten Jockey Purses\",height=400,width=850)\nfigBest10.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:03.828060Z","iopub.execute_input":"2022-11-10T11:34:03.828415Z","iopub.status.idle":"2022-11-10T11:34:03.896590Z","shell.execute_reply.started":"2022-11-10T11:34:03.828357Z","shell.execute_reply":"2022-11-10T11:34:03.895715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* As shown in the table above, the best jockey is: ***Manuel Franco***,  the second place is for **Irad Ortiz Jr** and the third place is for **Jose Lezcano**, hence our analysis will focus on **Manuel Franco**.\n\n![Manuel Franco](https://extrabetamerica.imgix.net/a75caa93a8a04fe185a0eaceb44b9d61.jpg)","metadata":{}},{"cell_type":"markdown","source":"### 3. The Global Race Positions and Total Purses by Jockeys ","metadata":{}},{"cell_type":"code","source":"pos=data.loc[:,['jockey','position']]  \nposcros=pd.crosstab(pos.jockey,pos.position) \ncolnames = ['position_1','position_2','position_3','position_4','position_5','position_6','position_7','position_8','position_9','position_10','position_11','position_12','position_13']\nFreq=poscros.to_numpy()\nnames=poscros.index.to_list()\nnamepos = pd.DataFrame(Freq,columns = colnames)\nnamepos = namepos.rename_axis('jokey').reset_index()\nBest=result.sort_values(by=['Jockey'],ascending=True)\nRes= pd.concat([Best,namepos], axis=1)\ndel Res['jokey']\nRes=Res.sort_values(by=['Jockey_Total_Purse'],ascending=False)\nRes=Res.reset_index()\ndel Res['index']\nRes.index += 1\nRes","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:03.897773Z","iopub.execute_input":"2022-11-10T11:34:03.898613Z","iopub.status.idle":"2022-11-10T11:34:03.948534Z","shell.execute_reply.started":"2022-11-10T11:34:03.898578Z","shell.execute_reply":"2022-11-10T11:34:03.947378Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"figpos = px.bar(Res.head(10), x=\"Jockey\", y=[\"position_1\",\"position_2\",\"position_3\",\"position_4\",\"position_5\",\"position_6\",\"position_7\",\"position_8\",\"position_9\",\"position_10\",\"position_11\",\"position_12\",\"position_13\"],title=\"Distribution of positions by jockey\",height=500)\nfigpos.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:03.950239Z","iopub.execute_input":"2022-11-10T11:34:03.950772Z","iopub.status.idle":"2022-11-10T11:34:04.096932Z","shell.execute_reply.started":"2022-11-10T11:34:03.950731Z","shell.execute_reply":"2022-11-10T11:34:04.095471Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* It is clearly displayed in the graph above that the positions most frequently occupied by the top ten jockeys are the one going from the **first to the fifth and sixth position**.","metadata":{}},{"cell_type":"markdown","source":"### 4. Average Purses By Race Position","metadata":{}},{"cell_type":"code","source":"pospurese=pd.crosstab(data.position,data.pursebyjokey)\ncrosmatt=pospurese.to_numpy()\npurs=list(pospurese.columns.values)\npursjk= np.array(purs)\nAA=crosmatt\nBB=pursjk\nPP=Global (AA,BB)\nFF= pd.DataFrame(PP)\nSS=FF.sum(axis=1)\nSS= pd.DataFrame(SS)\nSS.index += 1\nSS.columns = ['Global']\nNB=data.loc[:,['position']]\nNB=NB.value_counts()\nNB=NB.reset_index()\ndel NB['position']\nNB.columns = ['FreqPos']\nNB.index += 1\nAPBRP= pd.concat([SS,NB], axis=1)##Average Purses By Race Position\nAPBRP['PurseByPos']=APBRP['Global']/APBRP['FreqPos']\nAPBRP=APBRP.reset_index()\nAPBRP.index += 1\nAPBRP.rename(columns = {'index':'RacePosition'}, inplace = True)\nAPBRP##Average Purses By Race Position","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:04.099068Z","iopub.execute_input":"2022-11-10T11:34:04.099828Z","iopub.status.idle":"2022-11-10T11:34:04.610305Z","shell.execute_reply.started":"2022-11-10T11:34:04.099780Z","shell.execute_reply":"2022-11-10T11:34:04.609008Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"figAPBRP = px.bar(APBRP,x = \"RacePosition\", y = \"PurseByPos\",color=\"PurseByPos\",height=420,title=\"Average Purses By Race Position\")\nfigAPBRP.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:04.615348Z","iopub.execute_input":"2022-11-10T11:34:04.615761Z","iopub.status.idle":"2022-11-10T11:34:04.688376Z","shell.execute_reply.started":"2022-11-10T11:34:04.615728Z","shell.execute_reply":"2022-11-10T11:34:04.687067Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* As shown in the graph above, the **first five** positions are those that offer the **highest gain (purse)**, the average purses are, naturaly the highest in the first position, with about **45 000 USD**, the fifth position offers on average a purse of about **1500 USD**.","metadata":{}},{"cell_type":"markdown","source":" ***First Concluion***\n  * Based on this first part of the analysis, the following useful information or conclusion can be drawn, namely:\n* **Manuel Franco** is the **best jockey**, i.e the one who won the most purse.\n* The **first five to six positions** offer the most gain.\n* Positions **1** to **5** are the positions most coveted by jockeys, precisely the best jockeys.\n","metadata":{}},{"cell_type":"markdown","source":"<div style=\"padding:10px;color:blue;margin:0;font-size:150%;text-align:center;display:fill;border-radius:3px;background-color:#aaf0f0;overflow:hidden;font-weight:700;border: 5px solid #21a3a3;\">  2. Manual Franco Courses Participations and Performaces Analysis</div>","metadata":{}},{"cell_type":"markdown","source":"### 2. Manual Franco Courses Participations and Performaces Analysis","metadata":{}},{"cell_type":"markdown","source":"* Introduction\nThe following work consists in the analysis of the performances of the best jockey: Manuel Franco, the objective being to try to extract useful information concerning the participation in the races by this jockey, we will therefore try to answer the following questions:\n* Does this jockey prefer to participate in a specific stadium (track_id) rather than another?\n* Does Manuel Franco prefer to participate in a specific race conditions? \n* Does Manuel Franco prefer to participate in a specific type of races?\n* ...\n\n**In short**, we are seeking of any useful information relating to **the choices and the participation** in the races by the **best jockey: Manuel Franco**.\n","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### 1. Manuel Franco Courses Participations","metadata":{}},{"cell_type":"code","source":"data2 = pd.read_excel('../input/manual-franco-races/Manual_Franco_Races.xlsx')","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:04.690239Z","iopub.execute_input":"2022-11-10T11:34:04.690931Z","iopub.status.idle":"2022-11-10T11:34:05.160046Z","shell.execute_reply.started":"2022-11-10T11:34:04.690883Z","shell.execute_reply":"2022-11-10T11:34:05.158870Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### A. Total Races Completed By Manuel Franco in Each Track_id or Stadium ","metadata":{}},{"cell_type":"code","source":"track_id=data2.loc[:,['track_id']]\ntrack_id=track_id.value_counts()\ntrack_id= pd.DataFrame(track_id)\ntrack_id.columns = ['Freqtrack_id']\ntrack_id=track_id.reset_index()\ntrack_id.index += 1\nfigtrack_id = px.bar(track_id,x=\"track_id\", y = \"Freqtrack_id\",color=\"Freqtrack_id\",height=420,title=\"Races Completed By Manuel Franco in Each Stadium\",text=\"Freqtrack_id\")\nfigtrack_id.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.162026Z","iopub.execute_input":"2022-11-10T11:34:05.163202Z","iopub.status.idle":"2022-11-10T11:34:05.234031Z","shell.execute_reply.started":"2022-11-10T11:34:05.163154Z","shell.execute_reply":"2022-11-10T11:34:05.232783Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* By viewing the data relating to the participation of **Manuel Franco** in the different \"track_id\" or stadiums, it appears that he participated in almost **46%** of his races in the **Aqueduct** stadium and almost **39%** in the **Belmont** stadium, against only **17.5%** in the **Saratoga** stadium.","metadata":{}},{"cell_type":"markdown","source":"### B. Type of Races Performed By  Manuel Franco","metadata":{}},{"cell_type":"code","source":"course_type=data2.loc[:,['course_type']]\ncourse_type=course_type.value_counts()\ncourse_type= pd.DataFrame(course_type)\ncourse_type.columns = ['Freqcourse_type']\ncourse_type=course_type.reset_index()\ncourse_type.index += 1\nfigcourse_type = px.bar(course_type,x=\"course_type\", y = \"Freqcourse_type\",color=\"Freqcourse_type\",height=420,title=\"Race Types Performed By the Manuel Franco\",text=\"Freqcourse_type\")\nfigcourse_type.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.235793Z","iopub.execute_input":"2022-11-10T11:34:05.237019Z","iopub.status.idle":"2022-11-10T11:34:05.308523Z","shell.execute_reply.started":"2022-11-10T11:34:05.236968Z","shell.execute_reply":"2022-11-10T11:34:05.307371Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* A reading of the graph relating to the types of races carried out by Manuel Franco clearly shows that this jockey focuses his participation on races of the type: Dirt (D) with nearly **67%** of the races carried out in this type of terrain.\nNearly **29%** of races distributed on turf (T) and Inner turf (I) type races.","metadata":{}},{"cell_type":"markdown","source":"### C. Conditions of the Races Performed By the Manuel Franco","metadata":{}},{"cell_type":"code","source":"track_condition=data2.loc[:,['track_condition']]\ntrack_condition=track_condition.value_counts()\ntrack_condition= pd.DataFrame(track_condition)\ntrack_condition.columns = ['Freqtrack_condition']\ntrack_condition=track_condition.reset_index()\ntrack_condition.index += 1\nfigtrack_condition = px.bar(track_condition,x=\"track_condition\", y = \"Freqtrack_condition\",color=\"Freqtrack_condition\",height=420,title=\"Conditions of the Races Performed By the Manuel Franco\",text=\"Freqtrack_condition\")\nfigtrack_condition.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.310702Z","iopub.execute_input":"2022-11-10T11:34:05.311203Z","iopub.status.idle":"2022-11-10T11:34:05.382093Z","shell.execute_reply.started":"2022-11-10T11:34:05.311157Z","shell.execute_reply":"2022-11-10T11:34:05.380892Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* Manuel Franco will have participated in **47%** of the races under the condition: **Fast (FT)**, the rest of the races are distributed under the condition: **Firm (FM)** with **23.5%** and **11.6%** under the conditions of the **Good (GD**) and **Sloppy (SY)**.","metadata":{}},{"cell_type":"markdown","source":"### D. Starting time of Manual Franco Courses","metadata":{}},{"cell_type":"code","source":"time=data2.loc[:,['post_time']]\ntime=time.value_counts()\ntime= pd.DataFrame(time)\ntime.columns = ['Freqcourse_time']\ntime=time.reset_index()\ntime.index += 1\ntime=time.sort_values(by=['Freqcourse_time'],ascending=False)\nfigtime = px.bar(time,x=\"post_time\", y = \"Freqcourse_time\",color=\"Freqcourse_time\",height=420,title=\"Manuel Franco Starting Courses Times\",text=\"Freqcourse_time\")\nfigtime.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.384539Z","iopub.execute_input":"2022-11-10T11:34:05.385416Z","iopub.status.idle":"2022-11-10T11:34:05.457791Z","shell.execute_reply.started":"2022-11-10T11:34:05.385349Z","shell.execute_reply":"2022-11-10T11:34:05.456730Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* What appears from the graph relating to the distribution of start times in which Franco participated, is that he **does not generally participate in races between 8:00 am and 10:00 pm**.\n* Added to the fact that it could be his own choice, it is also **important to mention the fact that the races generally start from 10:00pm**.\n* Furthermore, it should be noted that the data does not show a particular time preference for Manuel Franco, this could be explained by the fact that the organization of the races depends exclusively on the organizers.\n\n","metadata":{}},{"cell_type":"markdown","source":"### E. Manuel Franco Courses Distances","metadata":{}},{"cell_type":"code","source":"distance_id=data2.loc[:,['distance_id']]\ndistance_id=distance_id.value_counts()\ndistance_id= pd.DataFrame(distance_id)\ndistance_id.columns = ['Freqdistance_id']\ndistance_id=distance_id.reset_index()\ndistance_id.index += 1\ndistance_id=distance_id.sort_values(by=['distance_id'],ascending=True)\nfigdistance_id = px.bar(distance_id,x=\"distance_id\", y = \"Freqdistance_id\",color=\"Freqdistance_id\",height=420,title=\"Manuel Franco Courses Distances\",text=\"Freqdistance_id\")\nfigdistance_id.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.459018Z","iopub.execute_input":"2022-11-10T11:34:05.459334Z","iopub.status.idle":"2022-11-10T11:34:05.534786Z","shell.execute_reply.started":"2022-11-10T11:34:05.459305Z","shell.execute_reply":"2022-11-10T11:34:05.533890Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* Based on the data, it appears that Manuel Franco has a preference for races in the distances vary between **550 (5.5 furlongs)** and **900 (9 furlongs)**, particularly the distances equal to **600 (6 furlongs)** and **800 (8 furlongs)**, races with distances around **100 (1 furlong)** to **140 (1.4 furlong)** are also appreciated but to a lesser degree. \n* Manuel Franco's preference for long races **could be explained by his racing strategy**, this will be analyzed later.","metadata":{}},{"cell_type":"markdown","source":"### F. Manuel Franco Run Up Distance Races","metadata":{}},{"cell_type":"code","source":"run_up_distance=data2.loc[:,['run_up_distance']]\nrun_up_distance=run_up_distance.value_counts()\nrun_up_distance= pd.DataFrame(run_up_distance)\nrun_up_distance.columns = ['Freqrun_up_distance']\nrun_up_distance=run_up_distance.reset_index()\nrun_up_distance.index += 1\nrun_up_distance=run_up_distance.sort_values(by=['Freqrun_up_distance'],ascending=True)\nfigrun_up_distance = px.bar(run_up_distance,x=\"run_up_distance\", y = \"Freqrun_up_distance\",color=\"Freqrun_up_distance\",height=420,title=\"Manuel Franco Run Up Distance Races\",text=\"Freqrun_up_distance\")\nfigrun_up_distance.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.536359Z","iopub.execute_input":"2022-11-10T11:34:05.536965Z","iopub.status.idle":"2022-11-10T11:34:05.607100Z","shell.execute_reply.started":"2022-11-10T11:34:05.536929Z","shell.execute_reply":"2022-11-10T11:34:05.605866Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* It is found that the best jockey, Manuel Franco, has a preference for races with a run up distance between **50** and **200** feet.\n* **Similar** to his preference for **long races**, this preference for races with a **long run up distance** could possibly be **explained** by his **race strategy**, an idea to be explored when **analyzing Manuel Franco's races**.","metadata":{}},{"cell_type":"markdown","source":"### H.Manuel Franco Odds and Earned Purse\n","metadata":{}},{"cell_type":"code","source":"oddsPurse=data2.loc[:,['odds','pursebyjokeyt']]  \noddsPurse=oddsPurse.sort_values(by=['pursebyjokeyt'],ascending=True)\nfigoddsPurse = px.bar(oddsPurse,x=\"odds\", y = \"pursebyjokeyt\",color=\"odds\")\nfigoddsPurse.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.608849Z","iopub.execute_input":"2022-11-10T11:34:05.609556Z","iopub.status.idle":"2022-11-10T11:34:05.679205Z","shell.execute_reply.started":"2022-11-10T11:34:05.609509Z","shell.execute_reply":"2022-11-10T11:34:05.678072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* What appears from the graph relating to the evolution of Manuel Franco's earnings according to his **odds**, is that the earnings obtained coincide with a **low odds**, it emerges from this that the **odds** attributed to this jockey **are significant**, and this due to the fact that a **low odds implies** that the jockey is **highely played by bettors**, which implies that he has a strong chance of winning or of placing well.\n* A low rating or **odds**  necessarily implies that the jockey often obtains good results, so it is necessary to **analyze his previous results**.","metadata":{}},{"cell_type":"markdown","source":"***Second Concluion***\n* Based on this second part of the analysis, the following useful information or conclusion can be drawn, namely:\n* It appears that the jockey Manuel Franco obviously chooses the races in which he participates, which is normal, and this is the case for all jockeys.\n* Some choice tendencies appear during the analysis of the characteristics and parameters of the races covered by Manuel Franco, the most striking tendencies are the following:\n * Manuel Franco favored participation in two stadiums: **Aqueduct with 46%** and **Belmont stadium with 39%**.\n  * This jockey focuses his participation on races of the type: Dirt (D) with nearly 67% of the races carried out in this type of terrain. Nearly 29% of races distributed on turf (T) and Inner turf (I) type races.\n  * Manuel Franco has a preference for races in the distances vary between **550 (5.5 furlongs)** and **900 (9 furlongs)**, particularly the distances equal to **600 (6 furlongs)** and **800 (8 furlongs)**, races with distances around **100 (1 furlong)** to **140 (1.4 furlong)** are also appreciated but to a lesser degree. \n  * It is found that the best jockey, Manuel Franco, has a preference for races with a run up distance between **50** and **200** feet.\n     \n* In summary, a certain **strategy appears**, Manuel Franco **has certain preferences** or **choices** of races.\n The **question** that arises is then :**whether this best jockey made effective choices and preferences**, this will be analyze in the next chapter.\n","metadata":{}},{"cell_type":"markdown","source":"### 2. Manuel Franco Performaces and Efficiency Analysis","metadata":{}},{"cell_type":"markdown","source":"As previously mentioned, it appears that Manuel Franco chose his races according to certain preferences, so we are going to analyze the parameters of the races he has done and try to reveal whether he has made a good choice of race and this on the basis of its results.","metadata":{}},{"cell_type":"markdown","source":"### A. Track_id Choice Efficiency","metadata":{}},{"cell_type":"code","source":"AQU=data2[data2['track_id'] == \"AQU\" ]\nBEL=data2[data2['track_id'] == \"BEL\" ]\nSAR=data2[data2['track_id'] == \"SAR\" ]\nAQUEF=AQU.loc[:,['position']] \nBELEF=BEL.loc[:,['position']] \nSAREF=SAR.loc[:,['position']] \nAQUEF=AQUEF.value_counts() \nBELEF=BELEF.value_counts() \nSAREF=SAREF.value_counts() \nAQUEF= pd.DataFrame(AQUEF)\nBELEF= pd.DataFrame(BELEF)\nSAREF= pd.DataFrame(SAREF)\nAQUEF.columns = ['Position_AQU']\nBELEF.columns = ['Position_BEL']\nSAREF.columns = ['Position_SAR']\nAQUEF=AQUEF.reset_index()\nBELEF=BELEF.reset_index()\nSAREF=SAREF.reset_index()\nAQUEF.index += 1\nBELEF.index += 1\nSAREF.index += 1\nAQUEF=AQUEF.sort_values(by=['position'],ascending=True)\nBELEF=BELEF.sort_values(by=['position'],ascending=True)\nSAREF=SAREF.sort_values(by=['position'],ascending=True)\nfigAQUEF = px.bar(AQUEF,x=\"position\", y = \"Position_AQU\",color=\"Position_AQU\",height=420,title=\"Manuel Franco Efficiency in Aqueduct\",text=\"Position_AQU\")\nfigBELEF = px.bar(BELEF,x=\"position\", y = \"Position_BEL\",color=\"Position_BEL\",height=420,title=\"Manuel Franco Efficiency in Belmont\",text=\"Position_BEL\")\nfigSAREF = px.bar(SAREF,x=\"position\", y = \"Position_SAR\",color=\"Position_SAR\",height=420,title=\"Manuel Franco Efficiency in Saratoga\",text=\"Position_SAR\")\nfigAQUEF.show()\nfigBELEF.show()\nfigSAREF.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.680582Z","iopub.execute_input":"2022-11-10T11:34:05.680990Z","iopub.status.idle":"2022-11-10T11:34:05.883453Z","shell.execute_reply.started":"2022-11-10T11:34:05.680960Z","shell.execute_reply":"2022-11-10T11:34:05.882301Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* According to the results relating to the number of positions in between the **first** and **fifth place**, it appears that nearly **85%** and **82%** of the final positions obtained by Manuel Franco in the **Aqueduct track** and **Belmont** are between **first** and **fifth** place against almost **64%** in the **Saratoga** track.\n* These results clearly demonstrate that Manuel Franco performs better in the **Aqueduct** and **Belmont** stadiums compared to the **Saratoga** stadium, which demonstrates that Manuel Franco's choice of stadium is **efficient** and **judicious**.\n","metadata":{}},{"cell_type":"markdown","source":"### B. Type of Races Choice Efficiency","metadata":{}},{"cell_type":"code","source":"crospurseracetype=pd.crosstab(data2.race_type,data2.position)\ncrospurseracetypemat=crospurseracetype.to_numpy()\ncolnames = ['position_1','position_2','position_3','position_4','position_5','position_6','position_7','position_8','position_9','position_10','position_11','position_12','position_13']\nracetype=crospurseracetype.index.to_list()\nracetype= pd.DataFrame(racetype)\ncrospurseracetypemat= pd.DataFrame(crospurseracetypemat,columns = colnames)\nracetype.columns = ['racetype'] \nRace= pd.concat([racetype,crospurseracetypemat], axis=1)\nRace= pd.DataFrame(Race)\nRace","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.885102Z","iopub.execute_input":"2022-11-10T11:34:05.885441Z","iopub.status.idle":"2022-11-10T11:34:05.922359Z","shell.execute_reply.started":"2022-11-10T11:34:05.885375Z","shell.execute_reply":"2022-11-10T11:34:05.921227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"figRace = px.bar(Race, x=\"racetype\", y=[\"position_1\",\"position_2\",\"position_3\",\"position_4\",\"position_5\",\"position_6\",\"position_7\",\"position_8\",\"position_9\",\"position_10\",\"position_11\",\"position_12\",\"position_13\"],title=\"Manuel Franco Race Type Choice Efficiency\",height=500)\nfigRace.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:05.924014Z","iopub.execute_input":"2022-11-10T11:34:05.925060Z","iopub.status.idle":"2022-11-10T11:34:06.054492Z","shell.execute_reply.started":"2022-11-10T11:34:05.925020Z","shell.execute_reply":"2022-11-10T11:34:06.053479Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* The distribution of the final positions obtained by Manuel Franco according to the type of race clearly shows that he ranked in  positions between the **first** and the **fifth** place in the **majority** of **courses he decided to run**, which **demonstrates** that he **made** an **effective choice** of type of race. \n* for example, Manuel Franco completed a total of 193 **CLM** type races, in which he finished 53 times in first position, 53 in the second position, 37 times in the third position, 42 times in the fourth position and 32 times in the fifth position, which means that he has **achieved the goal of finishing in the top five places** in the majority of **CLM** type races, an objective, which according to our analysis constitutes the main goal of the best jockeys.\n","metadata":{}},{"cell_type":"markdown","source":"### C. Races Condition Choice Efficiency","metadata":{}},{"cell_type":"code","source":"FT=data2[data2['track_condition'] == \"FT\" ]\nFM=data2[data2['track_condition'] == \"FM\" ]\nGD=data2[data2['track_condition'] == \"GD\" ]\nSY=data2[data2['track_condition'] == \"SY\" ]\nMY=data2[data2['track_condition'] == \"MY\" ]\nYL=data2[data2['track_condition'] == \"YL\" ]\nFTEF=FT.loc[:,['position']] \nFMEF=FM.loc[:,['position']] \nGDEF=GD.loc[:,['position']] \nSYEF=SY.loc[:,['position']] \nMYEF=MY.loc[:,['position']] \nYLEF=YL.loc[:,['position']] \nFTEF=FTEF.value_counts() \nFMEF=FMEF.value_counts() \nGDEF=GDEF.value_counts() \nSYEF=SYEF.value_counts()\nMYEF=MYEF.value_counts()\nYLEF=YLEF.value_counts()\nFTEF= pd.DataFrame(FTEF)\nFMEF= pd.DataFrame(FMEF)\nGDEF= pd.DataFrame(GDEF)\nSYEF= pd.DataFrame(SYEF)\nMYEF= pd.DataFrame(MYEF)\nYLEF= pd.DataFrame(YLEF)\nFTEF.columns = ['Position_Fast']\nFMEF.columns = ['Position_Firm']\nGDEF.columns = ['Position_Good']\nSYEF.columns = ['Position_Sloppy']\nMYEF.columns = ['Position_Muddy']\nYLEF.columns = ['Position_Yielding']\nFTEF=FTEF.reset_index()\nFMEF=FMEF.reset_index()\nGDEF=GDEF.reset_index()\nSYEF=SYEF.reset_index()\nMYEF=MYEF.reset_index()\nYLEF=YLEF.reset_index()\nFTEF.index += 1\nFMEF.index += 1\nGDEF.index += 1\nSYEF.index += 1\nMYEF.index += 1\nYLEF.index += 1\nFTEF=FTEF.sort_values(by=['Position_Fast'],ascending=True)\nFMEF=FMEF.sort_values(by=['Position_Firm'],ascending=True)\nGDEF=GDEF.sort_values(by=['Position_Good'],ascending=True)\nSYEF=SYEF.sort_values(by=['Position_Sloppy'],ascending=True)\nMYEF=MYEF.sort_values(by=['Position_Muddy'],ascending=True)\nYLEF=YLEF.sort_values(by=['Position_Yielding'],ascending=True)\nfig_FT = px.bar(FTEF,x=\"position\", y = \"Position_Fast\",color=\"Position_Fast\",height=420,title=\"Manuel Franco Efficiency in Fast Condition\",text=\"Position_Fast\")\nfig_FM = px.bar(FMEF,x=\"position\", y = \"Position_Firm\",color=\"Position_Firm\",height=420,title=\"Manuel Franco Efficiency in Firm Condition\",text=\"Position_Firm\")\nfig_GD = px.bar(GDEF,x=\"position\", y = \"Position_Good\",color=\"Position_Good\",height=420,title=\"Manuel Franco  Efficiency in Good Condition\",text=\"Position_Good\")\nfig_SY = px.bar(SYEF,x=\"position\", y = \"Position_Sloppy\",color=\"Position_Sloppy\",height=420,title=\"Manuel Franco Efficiency in Sloppy Condition\",text=\"Position_Sloppy\")\nfig_MY = px.bar(MYEF,x=\"position\", y = \"Position_Muddy\",color=\"Position_Muddy\",height=420,title=\"Manuel Franco Efficiency in Muddy Condition\",text=\"Position_Muddy\")\nfig_YL = px.bar(YLEF,x=\"position\", y = \"Position_Yielding\",color=\"Position_Yielding\",height=420,title=\"Manuel Franco Efficiency in Yielding Condition\",text=\"Position_Yielding\")\nfig_FT.show()\nfig_FM.show()\nfig_GD.show()\nfig_SY.show()\nfig_MY.show()\nfig_YL.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:06.056174Z","iopub.execute_input":"2022-11-10T11:34:06.056550Z","iopub.status.idle":"2022-11-10T11:34:06.438436Z","shell.execute_reply.started":"2022-11-10T11:34:06.056516Z","shell.execute_reply":"2022-11-10T11:34:06.437434Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### D. Races Distances Efficiency","metadata":{}},{"cell_type":"code","source":"Dist=pd.crosstab(data2.distance_id,data2.position) \ncolnames = ['position_1','position_2','position_3','position_4','position_5','position_6','position_7','position_8','position_9','position_10','position_11','position_12','position_13']\nDisFreq=Dist.to_numpy()\nDistances=Dist.index.to_list()\nDistances= np.array(Distances)\nDisFreq = pd.DataFrame(DisFreq,columns = colnames)\nDistances = pd.DataFrame(Distances)\nDistances.columns = ['Distances']\nDIS= pd.concat([Distances,DisFreq], axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:06.439884Z","iopub.execute_input":"2022-11-10T11:34:06.440423Z","iopub.status.idle":"2022-11-10T11:34:06.465368Z","shell.execute_reply.started":"2022-11-10T11:34:06.440379Z","shell.execute_reply":"2022-11-10T11:34:06.464308Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"figdistance = px.bar(DIS, x=\"Distances\", y=[\"position_1\",\"position_2\",\"position_3\",\"position_4\",\"position_5\",\"position_6\",\"position_7\",\"position_8\",\"position_9\",\"position_10\",\"position_11\",\"position_12\",\"position_13\"],title=\"Manuel Franco Efficiency in Races Distance \",height=500)\nfigdistance.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:06.467029Z","iopub.execute_input":"2022-11-10T11:34:06.467369Z","iopub.status.idle":"2022-11-10T11:34:06.598352Z","shell.execute_reply.started":"2022-11-10T11:34:06.467336Z","shell.execute_reply":"2022-11-10T11:34:06.596909Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* It is noted that Manuel Franc obtains good final positions, that is to say between the first and the fifth position, during the races whose distance is between **550 (5.5 furlongs)** and **900 (9 furlongs)**, implying that his preference for these distances is **justified** and **judicious**.\n","metadata":{}},{"cell_type":"markdown","source":"### E. Run Up Distance Efficiency","metadata":{}},{"cell_type":"code","source":"Run_Up_Dist=pd.crosstab(data2.run_up_distance,data2.position) \ncolnames = ['position_1','position_2','position_3','position_4','position_5','position_6','position_7','position_8','position_9','position_10','position_11','position_12','position_13']\nRun_Up_DisFreq=Run_Up_Dist.to_numpy()\nRNPDistances=Run_Up_Dist.index.to_list()\nRNPDistances= np.array(RNPDistances)\nRun_Up_DisFreq = pd.DataFrame(Run_Up_DisFreq,columns = colnames)\nRNPDistances = pd.DataFrame(RNPDistances)\nRNPDistances.columns = ['RNPDistances']\nRNPDIS= pd.concat([RNPDistances,Run_Up_DisFreq], axis=1)\nRNPDIS.index += 1\nRNPDIS","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:06.604597Z","iopub.execute_input":"2022-11-10T11:34:06.604962Z","iopub.status.idle":"2022-11-10T11:34:06.646764Z","shell.execute_reply.started":"2022-11-10T11:34:06.604930Z","shell.execute_reply":"2022-11-10T11:34:06.645569Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"figrnpdistance = px.bar(RNPDIS, x=\"RNPDistances\", y=[\"position_1\",\"position_2\",\"position_3\",\"position_4\",\"position_5\",\"position_6\",\"position_7\",\"position_8\",\"position_9\",\"position_10\",\"position_11\",\"position_12\",\"position_13\"],title=\"Manuel Franco Efficiency in Run Up Distance  \",height=500)\nfigrnpdistance.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:06.648278Z","iopub.execute_input":"2022-11-10T11:34:06.649021Z","iopub.status.idle":"2022-11-10T11:34:06.774016Z","shell.execute_reply.started":"2022-11-10T11:34:06.648984Z","shell.execute_reply":"2022-11-10T11:34:06.772923Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* In the same way as the choice of distances, the choice of run up distances, is also effective, indeed, the graph shows that Manuel Franco obtains satisfactory positions (between 1 and 5) in the races having a rub up distance between **50** and **200** feet.","metadata":{}},{"cell_type":"markdown","source":"***Third Concluion***","metadata":{}},{"cell_type":"markdown","source":"* Based on this third part of the analysis, the following useful information or conclusion can be drawn:\n  * It it **seems** that Manuel Franc has a **global strategy** based on the **choice of**: Staduim, race conditions, race type, race distance and run up distance.\n  * It's clearly appears that the jockey Manual Franco obtain a **good finale race positions** according to the different **choices he made** in : Stadium, race condition,race type, race distance, run up distance, which means that he use to make a **good decision and choices and decision**.\n  \n  * After this analysis and these conclusions, the question that arises is to ask whether it is possible **to predict** the **position** of **Manuel Franco** on the **basis** of his **choices**, this question will be treated in the next chapter.\n  \n","metadata":{}},{"cell_type":"markdown","source":"<div style=\"padding:10px;color:blue;margin:0;font-size:150%;text-align:center;display:fill;border-radius:3px;background-color:#aaf0f0;overflow:hidden;font-weight:700;border: 5px solid #21a3a3;\"> 3. Manuel Franco Race Choice Strategy Effectiveness Prediction</div>","metadata":{}},{"cell_type":"markdown","source":"### 3.Manuel Franco Race Choice Strategy Effectiveness Prediction","metadata":{}},{"cell_type":"markdown","source":"**Introduction**\n\nIn this chapter, we will try to build a simple statistical model, to judge the effectiveness of the choices of Manuel Franco.\nIn other words, we will try to predict Manuel Franco's final position, and therefore **the effectiveness of his picks** in a given race based on the choices and parameters we described in the previous chapter.\n\n**Model assumptions**\n\n* The model that will be chosen is a dichotomous Logitstic model or Logi model.\n* Two states will therefore be predicted: **Success** and **Failure**.\n* Based on the results of the analyzes carried out previously, we have highlighted the fact that the best jockey always tries to finish his races in the first five places at least.\n* Thus, If Manuel Franco is placed in **positions 1 to 5**, he will have **succeeded** in his race, otherwise he will have **failed**. \n","metadata":{}},{"cell_type":"markdown","source":"### A. First Race Prediction Model  ","metadata":{}},{"cell_type":"markdown","source":"Since Manuel Franco chooses his races based on the parameters: \n\n* **a)** **track_id**;\n* **b)** **distance_id**;\n* **c)** **course_type**;\n* **d)** **track_condition**;\n* **e)** **run_up_distance**;\n* **f)** **race_type**.\n\nwe will build a first model based on these explanatory variables or features.\n\n* In order to be able to use the **qualitative variables** (track_id,course_type,track_condition,race_type), we will simply codify them, each variable will be codified from **1 to n**, **n** being the number of modalities of the qualitative variable to be used.\n\n* For example: the variable **course_type** will be coded between **1 and 5**, as long as this variable contains **five (5)** terms or modalities . (1) - Hurdle, (2) - Dirt, (3) - Outer turf, (4) - Inner turf, (5) - turf, hence the used variable will be the coded one : **\"course_type_CD\"** and so on for the other qualitative variables.\n\n* we will also add a new variable named :**Objectif**, this variable is based on the finale race position, if the position is between 1 to 5, objectif is equal to 1, wich means that Manuel Franco succedded, else the objectif variable is equal to 0, which means a failure.\n\n* The coding has been previously prepared in the data2 file.\n","metadata":{}},{"cell_type":"markdown","source":"* **First model results**","metadata":{}},{"cell_type":"markdown","source":"* The first model **doesn't give** good **results** with regard to the precision of the estimation of the \"failure\" state with a value of 0%, i.e. the state where Manuel Franco did not rank among the first five places, added to the fact that the score **AUC = 0.65** happens to be average, the prediction of the state of \"success\" is much better with an accuracy of **79%** \n* We will therefore improve the model by adding a second variable, the **'odds'** variable.","metadata":{}},{"cell_type":"markdown","source":"### B. Second Race Prediction Model  ","metadata":{}},{"cell_type":"markdown","source":"* In the second model, we will **improve the feature_column** by adding the variable **\"odds\"**, a variable that provide information about **the performance of the jockey**, especially in the **previous races**.","metadata":{}},{"cell_type":"code","source":"feature_cols = ['track_id_CD','distance_id','course_type_CD','track_condition_CD','run_up_distance','race_type_CD','odds']# Selected Variables \nX = data2[feature_cols]\ny = data2.Objectif\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25,random_state=16)\nlogreg = LogisticRegression(random_state=16)\nlogreg.fit(X_train, y_train)\ny_pred = logreg.predict(X_test)\ncnf_matrix = metrics.confusion_matrix(y_test, y_pred)\ntarget_names = ['failure', 'success']\nprint(classification_report(y_test, y_pred, target_names=target_names))\ny_pred_proba = logreg.predict_proba(X_test)[::,1]\nfpr, tpr, _ = metrics.roc_curve(y_test,  y_pred_proba)\nauc = metrics.roc_auc_score(y_test, y_pred_proba)\nplt.figure(figsize=(14,6))\nplt.plot(fpr,tpr,label=\"data 2, auc=\"+str(auc))\nplt.title('ROC Curve Analysis', fontweight='bold', fontsize=10)\nplt.legend(prop={'size':13}, loc='lower right')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:06.775801Z","iopub.execute_input":"2022-11-10T11:34:06.776161Z","iopub.status.idle":"2022-11-10T11:34:07.056593Z","shell.execute_reply.started":"2022-11-10T11:34:06.776127Z","shell.execute_reply":"2022-11-10T11:34:07.055402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* By adding the \"odds\" variable, we note a clear improvement in the performance of the prediction model in terms of accuracy and the AUC parameter, **AUC=0.77**, AUC, thus the accuracy of the model for the prediction of success cases is **82%** and is of **80%** for failure cases.\n* In the next model, we will proceed to the addition of an indicator variable the performance of Manuel Franco during a previous race, this variable will be his gain (purse) obtained during the previous race.","metadata":{}},{"cell_type":"markdown","source":"**Comment**:\n* The **first trial model** proposes to **predict the success or failure** of the jockey Manuel Franco on the basis of the parameters:\n  **track_id**,**distance_id**,**course_type**,**track_condition**,**run_up_distance**,**race_type**. \n* The second model tries to improve the results obtained by adding the variable 'odds', which happens to be the odds of the jockey before the race.\n\n* The results obtained show a marked improvement in the model's forecasting accuracy with a value of **82%**, which demonstrates the impact of the added value.It is therefore appropriate to ask questions about this variable!\n\n* Intuitively, we know that the variable **odds** is a good indicator about the jockey current performances, whose calculation is based on the results currently obtained by the jockey, which makes sense, as long as the more a jockey obtains good results, the more its rating is low, since it attracts bettors.\n* Therefore, we will be tempted to include a variable indicating the results obtained by the jockey during the previous race, a variable which could be the purse won by the jockey during the previous race of each race, it will therefore be: **pursebyjokeyt-1**.\n\n","metadata":{}},{"cell_type":"markdown","source":"### C. Third Race Prediction Model  ","metadata":{}},{"cell_type":"markdown","source":"* In order to obtain the value of the purse won by Manuel Franco before each race, we will prepare a small application, called **Prevpurse** (Previews Purse), which affects for each given race the gain (purse) of the race which preceded, so we get the variable:**\"pursejockeyt_1\"**, which we will use when estimating the third model.\n* Since we don't have the value of purse in t=0, we replace it buy the average purse values of Manuel Franco, which is 11740 USD, even that this don't have a big signfication or impact in the final result.","metadata":{}},{"cell_type":"code","source":"def Prevpurse (A):\n    n=len(A);B=np.zeros((n,1))\n    for i in range(1,n):\n        B[i:i+1,]=A[i-1:i,]\n    return(B)","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:07.058048Z","iopub.execute_input":"2022-11-10T11:34:07.058639Z","iopub.status.idle":"2022-11-10T11:34:07.064560Z","shell.execute_reply.started":"2022-11-10T11:34:07.058604Z","shell.execute_reply":"2022-11-10T11:34:07.063445Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pursejockeyt=data2.loc[:,['pursebyjokeyt']]\npursejockeyt= np.array(pursejockeyt)\nQ=pursejockeyt\npursejockeyt_1=Prevpurse (Q)\npursejockeyt_1[0:1,]=11740\npursejockeyt_1= pd.DataFrame(pursejockeyt_1)\npursejockeyt_1.columns = ['pursejockeyt_1']\ndata2= pd.concat([data2,pursejockeyt_1], axis=1)\npursejockeyt_1.index += 1\npursejockeyt_1","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:07.066050Z","iopub.execute_input":"2022-11-10T11:34:07.066366Z","iopub.status.idle":"2022-11-10T11:34:07.094069Z","shell.execute_reply.started":"2022-11-10T11:34:07.066337Z","shell.execute_reply":"2022-11-10T11:34:07.092974Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"feature_cols = ['track_id_CD','distance_id','course_type_CD','track_condition_CD','run_up_distance','race_type_CD','odds','pursejockeyt_1'] \nX = data2[feature_cols]\ny = data2.Objectif\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25,random_state=16)\nlogreg = LogisticRegression(random_state=16)\nlogreg.fit(X_train, y_train)\ny_pred = logreg.predict(X_test)\ncnf_matrix = metrics.confusion_matrix(y_test, y_pred)\ntarget_names = ['failure', 'success']\nprint(classification_report(y_test, y_pred, target_names=target_names))\ny_pred_proba = logreg.predict_proba(X_test)[::,1]\nfpr, tpr, _ = metrics.roc_curve(y_test,  y_pred_proba)\nauc = metrics.roc_auc_score(y_test, y_pred_proba)\nplt.figure(figsize=(14,6))\nplt.plot(fpr,tpr,label=\"data 2, auc=\"+str(auc))\nplt.title('ROC Curve Analysis', fontweight='bold', fontsize=10)\nplt.legend(prop={'size':13}, loc='lower right')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:07.095561Z","iopub.execute_input":"2022-11-10T11:34:07.095890Z","iopub.status.idle":"2022-11-10T11:34:07.366583Z","shell.execute_reply.started":"2022-11-10T11:34:07.095858Z","shell.execute_reply":"2022-11-10T11:34:07.365315Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Comment**\n* The third model gives the best results among the three models proposed.\n* The results from model number 3 give **82%** accuracy for predicting pass or pass status, and **85%** accuracy for predicting failure status and a parameter **AUC = 0.782** .\n\n**Conclusion**\n\n* Thus, the **third model** is ideal for predicting the success or failure of Manuel Franco.\n* It is therefore possible to **judge the effectiveness** of the choices of this best jockey on the basis of:\n\n**a)** Parameters of the chosen races: **track_id**,**distance_id**,**course_type**,**track_condition**,**run_up_distance**,**race_type**.\n\n**b)** From his cote: **odds** before a race.\n\n**c)** Earnings (or results) in previous races: **pursejockeyt_1**.\n\nAfter this analysis, it is clear that:\n\n* Manuel Franco impacts his results by choosing his races according to certain parameters.\n* His results also depend on his **odds** (cote) and therefore on his results in previous races, which demonstrates the existence of a **Motivation** parameter.\n\n* a question naturally arises, how Manuel Franco is going to manage the races, what is his racing strategy or strategies?; this is what we will try to analyze in the next chapter.","metadata":{}},{"cell_type":"markdown","source":"<div style=\"padding:10px;color:blue;margin:0;font-size:150%;text-align:center;display:fill;border-radius:3px;background-color:#aaf0f0;overflow:hidden;font-weight:700;border: 5px solid #21a3a3;\"> 4. Race Analysis of the Best Jockey</div>","metadata":{}},{"cell_type":"markdown","source":"### 4. Race Analysis of the Best Jockey","metadata":{}},{"cell_type":"markdown","source":"* **Introduction**\n* In this part of the analysis, it is a question of studying and analyzing the races carried out by Manuel Franco, in particular those where he finished in **first place**.\n* **The purpuse**\n* In the same way as the previous analyzes where we were able to extract a strategy of choice, a strategy which proved to be effective, we are going to work on the tracking data of the jockey during the races, to try to extract a trend or a strategy race and this on the basis of the following elements or parameters:\n* **Speed**.\n* **acceleration**.\n* **the kinetic energy**.\n\n* Secondly, it is a question of comparing Manuel Franco's racing strategy with the jockey who finished second in order to extract useful information, such as the decision to accelerate or slow down and on all the best moments of the race where the jockey made the difference.","metadata":{}},{"cell_type":"markdown","source":"**The Data**\n* In order to be able to analyze the races and the race strategy of Manuel Francon, we have added the column **\"Race_Position\"** in the Race Tracking file provided, it is in fact the final position obtained for each group of tracking (or tracking available ) and this for each race_number and program number including the tracking group.\n* To point out that a tracking group is the tracking of the jockey during a race_number and program_number.\n* Notice that we will **only consider** the races in wich **Manuel Franco win**, the data are in **data3 file**.\n* Given that Manuel Franco has a preference for races whose distances vary between 550 (1,400 meters) and 900 (9,000 meters), in particular distances equal to 600 (1,400 meters) and 800 (8,000 meters) we will analyze races within these typical distances at all three stadiums.\n* According to the tracking data provided, we will analyze according to the distances, the races carried out on the three stages separately, since each stage has its own characteristics and its distances, which will have the effect of highlighting a possible race strategy followed. by Manuel Franco.\n","metadata":{}},{"cell_type":"code","source":"data3 = pd.read_excel('../input/manual-franco-first-position-races/Races_Manual_Franco_First_Position.xlsx')\ndata3","metadata":{"execution":{"iopub.status.busy":"2022-11-10T11:34:07.368473Z","iopub.execute_input":"2022-11-10T11:34:07.371212Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* Preparing the Data","metadata":{}},{"cell_type":"markdown","source":"* In what follows we will select the data relating to the tracking of the races covered by Manuel Franco and in which he ranked first.\n* In order to have a global idea of Manuel Franco course strategies and management, we will analyse few races with distances within 600 to 850  from Aqueduct stadium, we selected this stadium randomely.\n** The **trajectory** of the jockey will be calculated using the **latitude** and **longitude** of **each point**, taking as **reference the XYZ** coordinate system at **point (0,0)**, we will calculate the **Euclidean distance** from point (0,0) for each point, and therefore we will have the trajectory of the jockey, this data is saved under the variable **'Squart'**.\n* Thus, by knowing the positions relative to the (0,0) we can calculate the **speed** and **acceleration** for each point.\n* The speed and acceleration for each time are calculated using the **speed()** and **Access()** functions which are developed below.\n* The speed and the acceleration will be calculated **every 0.25 second**, therefore the unit of measurement will be relative to the **reference** used and also to the time considered, **ie 0.25** second and not 1 second, the most important thing is not the universal unit of measurement, but to be able to extract a strategy.","metadata":{}},{"cell_type":"markdown","source":"**Extract tracking data** ","metadata":{}},{"cell_type":"code","source":"Aqueduct=data[data['track_id'] == \"AQU\"]\nAqueduct1=Aqueduct[Aqueduct['jockey'] == \"Manuel Franco\"]\nAqueduct2=Aqueduct1[Aqueduct1['position'] == 1]\nAqueduct600=Aqueduct2[Aqueduct2['distance_id'] == 600]\nAqueduct650=Aqueduct2[Aqueduct2['distance_id'] == 650]\nAqueduct750=Aqueduct2[Aqueduct2['distance_id'] == 700]\nAqueduct800=Aqueduct2[Aqueduct2['distance_id'] == 800]\nAqueduct850=Aqueduct2[Aqueduct2['distance_id'] == 850]","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQU600=data3[data3['race_date'] == \"2019-01-27\" ]\nAQU_600=AQU600[AQU600['Race_Position'] == 1 ]\nAQU__600=AQU_600[AQU_600['race_number'] == 5 ]#Extract tracking data for a race with a distance of 600\nAQU__600['time']=AQU__600['trakus_index']*0.25\nAQU650=data3[data3['race_date'] == \"2019-01-06\" ]\nAQU_650=AQU650[AQU650['Race_Position'] == 1 ]\nAQU__650=AQU_650[AQU_650['race_number'] == 6 ]#Extract tracking data for a race with a distance of 650\nAQU__650['time']=AQU__650['trakus_index']*0.25# Adding the time \nAQU750=data3[data3['race_date'] == \"2019-01-05\" ]\nAQU_750=AQU750[AQU750['Race_Position'] == 1 ]\nAQU__750=AQU_750[AQU_750['race_number'] == 8 ]#Extract tracking data for a race with a distance of 750\nAQU__750['time']=AQU__750['trakus_index']*0.25# Adding the time \nAQU800=data3[data3['race_date'] == \"2019-12-30\" ]\nAQU_800=AQU800[AQU800['Race_Position'] == 1 ]\nAQU__800=AQU_800[AQU_800['race_number'] == 4 ]#Extract tracking data for a race with a distance of 800\nAQU__800['time']=AQU__800['trakus_index']*0.25# Adding the time ","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Trajectory, Velocity and Acceleration for Aqueduct races**","metadata":{}},{"cell_type":"code","source":"def speed (A):\n    n=len(A);B=np.zeros((n,1));S=np.zeros((n,1))\n    for i in range(1,n):\n        B[i-1:i,]=A[i:i+1,]\n        S[i-1:i,]=(B[i-1:i,]-A[i-1:i,])/0.25\n    return(S)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def Acces (A):\n    n=len(A);B=np.zeros((n,1));Ac=np.zeros((n,1))\n    for i in range(1,n):\n        B[i-1:i,]=A[i:i+1,]\n        Ac[i-1:i,]=(B[i-1:i,]-A[i-1:i,])/0.25\n    return(Ac)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQU__600['latitude*2'] = AQU__600['latitude']**2\nAQU__600['longitude*2'] = AQU__600['longitude']**2\nAQU__600['long*2+lat*2'] = AQU__600['latitude*2']+AQU__600['longitude*2']\nAQU__600['Squart']=AQU__600['long*2+lat*2'].apply(np.sqrt)\nAQU__600=AQU__600.reset_index()\ndel AQU__600['index']\nspdaqu600=AQU__600['Squart']\nspdaqu600= np.array(spdaqu600)\nspdaqu600=speed(spdaqu600)\nspdaqu600= pd.DataFrame(spdaqu600) \nspdaqu600.columns = ['speedaqu600']\nspdaqu600=spdaqu600.reset_index()\ndel spdaqu600['index']\nAQU__600= pd.concat([AQU__600,spdaqu600], axis=1)\nAQUAC__600=AQU__600['speedaqu600']\nAQUAC__600= np.array(AQUAC__600)\nAQUAC__600= Acces (AQUAC__600)\nAQUAC__600= pd.DataFrame(AQUAC__600) \nAQUAC__600.columns = ['accelerationaqu600']\nAQU__600= pd.concat([AQU__600,AQUAC__600], axis=1)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQU__650['latitude*2'] = AQU__650['latitude']**2\nAQU__650['longitude*2'] = AQU__650['longitude']**2\nAQU__650['long*2+lat*2'] = AQU__650['latitude*2']+AQU__650['longitude*2']\nAQU__650['Squart']=AQU__650['long*2+lat*2'].apply(np.sqrt)# jockey trajectory\nAQU__650=AQU__650.reset_index()\ndel AQU__650['index']\nspdaqu650=AQU__650['Squart']\nspdaqu650= np.array(spdaqu650)\nspdaqu650=speed(spdaqu650)\nspdaqu650= pd.DataFrame(spdaqu650) \nspdaqu650.columns = ['speedaqu650']\nspdaqu650=spdaqu650.reset_index()\ndel spdaqu650['index']\nAQU__650= pd.concat([AQU__650,spdaqu650], axis=1)\nAQUAC__650=AQU__650['speedaqu650']\nAQUAC__650= np.array(AQUAC__650)\nAQUAC__650= Acces (AQUAC__650)\nAQUAC__650= pd.DataFrame(AQUAC__650) \nAQUAC__650.columns = ['accelerationaqu650']\nAQU__650= pd.concat([AQU__650,AQUAC__650], axis=1)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQU__750['latitude*2'] = AQU__750['latitude']**2\nAQU__750['longitude*2'] = AQU__750['longitude']**2\nAQU__750['long*2+lat*2'] = AQU__750['latitude*2']+AQU__750['longitude*2']\nAQU__750['Squart']=AQU__750['long*2+lat*2'].apply(np.sqrt)\nAQU__750=AQU__750.reset_index()\ndel AQU__750['index']\nspdaqu750=AQU__750['Squart']\nspdaqu750= np.array(spdaqu750)\nspdaqu750=speed(spdaqu750)\nspdaqu750= pd.DataFrame(spdaqu750) \nspdaqu750.columns = ['speedaqu750']\nspdaqu750=spdaqu750.reset_index()\ndel spdaqu750['index']\nAQU__750= pd.concat([AQU__750,spdaqu750], axis=1)\nAQUAC__750=AQU__750['speedaqu750']\nAQUAC__750= np.array(AQUAC__750)\nAQUAC__750= Acces (AQUAC__750)\nAQUAC__750= pd.DataFrame(AQUAC__750) \nAQUAC__750.columns = ['accelerationaqu750']\nAQU__750= pd.concat([AQU__750,AQUAC__750], axis=1)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQU__800['latitude*2'] = AQU__800['latitude']**2\nAQU__800['longitude*2'] = AQU__800['longitude']**2\nAQU__800['long*2+lat*2'] = AQU__800['latitude*2']+AQU__800['longitude*2']\nAQU__800['Squart']=AQU__800['long*2+lat*2'].apply(np.sqrt)\nAQU__800=AQU__800.reset_index()\ndel AQU__800['index']\nspdaqu800=AQU__800['Squart']\nspdaqu800= np.array(spdaqu800)\nspdaqu800=speed(spdaqu800)\nspdaqu800= pd.DataFrame(spdaqu800) \nspdaqu800.columns = ['speedaqu800']\nspdaqu800=spdaqu800.reset_index()\ndel spdaqu800['index']\nAQU__800= pd.concat([AQU__800,spdaqu800], axis=1)\nAQUAC__800=AQU__800['speedaqu800']\nAQUAC__800= np.array(AQUAC__800)\nAQUAC__800= Acces (AQUAC__800)\nAQUAC__800= pd.DataFrame(AQUAC__800) \nAQUAC__800.columns = ['accelerationaqu800']\nAQU__800= pd.concat([AQU__800,AQUAC__800], axis=1)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Trajectory Analysis**","metadata":{}},{"cell_type":"code","source":"AQUTRAJ600 = px.scatter(AQU__600,x=\"latitude\", y=\"longitude\")\nAQUTRAJ600.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUTRAJ650 = px.scatter(AQU__600,x=\"latitude\", y=\"longitude\")\nAQUTRAJ650.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUTRAJ750 = px.scatter(AQU__750,x=\"latitude\", y=\"longitude\")\nAQUTRAJ750.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUTRAJ800 = px.scatter(AQU__800,x=\"latitude\", y=\"longitude\")\nAQUTRAJ800.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Comment** : \n* Plotting the positions in the XYZ frame brings out the shape of the terrain in which the run was made.\n* We will therefore base ourselves on this trajectory to analyze the speed and acceleration of Manuel Franco in these different races.","metadata":{}},{"cell_type":"markdown","source":"**Speed Analysis**","metadata":{}},{"cell_type":"code","source":"AQUfigspeed600 = px.bar(AQU__600,x=\"time\", y=\"speedaqu600\",color=\"speedaqu600\")\nAQUfigspeed600.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUfigspeed650 = px.bar(AQU__650,x=\"time\", y=\"speedaqu650\",color=\"speedaqu650\")\nAQUfigspeed650.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUfigspeed750 = px.bar(AQU__750,x=\"time\", y=\"speedaqu750\",color=\"speedaqu750\")\nAQUfigspeed750.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUfigspeed800 = px.bar(AQU__800,x=\"time\", y=\"speedaqu800\",color=\"speedaqu800\")\nAQUfigspeed800.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Comment**\n* What emerges from the analysis of the velocity curves in the Aqueduct stadium for the different distances is the following:\n* The evolution of Manuel Franco's speed is characterized by three (3) phases:\n  - A first phase which begins at the start of the race where the jockey gradually increases his speed up to a certain speed while trying to maintain a more or less constant rhythm, which denotes a preparation for a next stage.\n  - A very intense second phase where Manuel Franco accelerates abruptly until reaching a maximum, this phase always begins in the **circular part** of the **trajectory**, once the speed peak reaches, a drop in speed is observed.\n  - A Third phase where the jockey considerably reduces the speed, perhaps due to the horse's abilities in general.\n","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"markdown","source":"**Acceleration**","metadata":{}},{"cell_type":"code","source":"AQUfigaccel600 = px.bar(AQU__600,x=\"time\", y=\"accelerationaqu600\",color=\"accelerationaqu600\")\nAQUfigaccel600.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUfigaccel650 = px.bar(AQU__650,x=\"time\", y=\"accelerationaqu650\",color=\"accelerationaqu650\")\nAQUfigaccel650.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUfigaccel750 = px.bar(AQU__750,x=\"time\", y=\"accelerationaqu750\",color=\"accelerationaqu750\")\nAQUfigaccel750.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"AQUfigaccel800 = px.bar(AQU__800,x=\"time\", y=\"accelerationaqu800\",color=\"accelerationaqu800\")\nAQUfigaccel800.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Comment** :\n * The layout of Manuel Franco's acceleration curves confirms what was analyzed in the speed part. It clearly appears that the jockey spares his stance during the first phase to prepare it for a second intense phase, and to finally reduce the pace in a significant way due \"perhaps\" to the ability of the horse.","metadata":{}},{"cell_type":"markdown","source":"**Conclusion**\n * D'après l'analyse effectuée sur quelques course de Manuel Franco dans le stade de Aqueduct, nous nottons que Manuel Franco ménage en premier lieu sa menture pour ensuite lui donner un rythme très élevé, un rythme qui atteindra son maximum dans la phase circulaire de la tréjectoire et qui se réduira progressivement.\n * It is **not said** that **this strategy** is only valid for Manuel Franco, **it probably followed by all jockeys**.\n * The difference could also be made in the **choice of horses by the jockey**, this could be the **subject of further analysis**.\n ","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"padding:20px;color:black;margin:0;font-size:250%;text-align:center;display:fill;border-radius:5px;background-color:#aaf0f0;overflow:hidden;font-weight:700;border: 5px solid #21a3a3;\"> **Global Conclusion**</div>","metadata":{}},{"cell_type":"markdown","source":"### 5.Global Conclusion","metadata":{}},{"cell_type":"markdown","source":"As a general conclusion, we will say the following:\n* In this work we have tried to highlight the fact that the best Jockey could have a race choice strategy and a race strategy.\n* It appears that Manuel Franco chose his races according to different parameters as presented.\n* It also appears that Manuel Franco has a certain racing strategy, at least in the Aqueduct stadium.\n* In order to be able to differentiate with more precision, it is recommended to carry out an analysis on the horses chosen by Manuel Franco, an analysis which requires more advanced data concerning the horses used in the races, **this could be the next challenge on Kaggle**!","metadata":{}}]}