Merge branch 'modServera' of https://git.wmi.amu.edu.pl/s478993/fantastyczne_gole into modServera
This commit is contained in:
commit
fc85d2f8f6
@ -342,10 +342,10 @@ const Hero = () => {
|
||||
<select className="dropbtn"
|
||||
onChange={event => setBodyPart(event.target.value)}
|
||||
defaultValue={bodyPart}>
|
||||
<option value = "prawa">Noga Prawa</option>
|
||||
<option value = "lewa">Noga Lewa</option>
|
||||
<option value = "glowa">Głowa</option>
|
||||
<option value = "inna" >Inna</option>
|
||||
<option value = "Right Foot">Noga Prawa</option>
|
||||
<option value = "Left Foot">Noga Lewa</option>
|
||||
<option value = "Head">Głowa</option>
|
||||
<option value = "Other" >Inna</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
@ -355,23 +355,23 @@ const Hero = () => {
|
||||
<form className="dropdown" id = "shootTypeList">
|
||||
<select className="dropbtn" onChange={event => setTechnique(event.target.value)}
|
||||
defaultValue = {technique}>
|
||||
<option value="zwykly"> Zwykły </option>
|
||||
<option value = "voley"> Wolej </option>
|
||||
<option value = "pol-voley"> Półwolej </option>
|
||||
<option value = "lob"> Lob </option>
|
||||
<option value = "szczupak"> Szczupak </option>
|
||||
<option value = "z_gory"> Kopnięcie z góry </option>
|
||||
<option value = "pietka"> Piętka </option>
|
||||
<option value="Normal"> Zwykły </option>
|
||||
<option value = "Volley"> Wolej </option>
|
||||
<option value = "Half Volley"> Półwolej </option>
|
||||
<option value = "Lob"> Lob </option>
|
||||
<option value = "Diving Head"> Szczupak </option>
|
||||
<option value = "Overhead Kick"> Kopnięcie z góry </option>
|
||||
<option value = "Backheel"> Piętka </option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form className="dropdown" id = "actionTypeList" onChange={event => setActionType(event.target.value)}
|
||||
defaultValue={technique}>
|
||||
<select className="dropbtn">
|
||||
<option value = "pozycyjny"> Atak Pozycyjny </option>
|
||||
<option value = "wolny"> Rzut Wolny </option>
|
||||
<option value = "karny"> Rzut Karny </option>
|
||||
<option value= "rozny"> Rzut Rozny </option>
|
||||
<option value = "Open Play"> Atak Pozycyjny </option>
|
||||
<option value = "Free Kick"> Rzut Wolny </option>
|
||||
<option value = "Penalty"> Rzut Karny </option>
|
||||
<option value= "Corner"> Rzut Rozny </option>
|
||||
<option value="rozpoczecie"> Rozpoczęcie </option>
|
||||
</select>
|
||||
</form>
|
||||
@ -379,10 +379,10 @@ const Hero = () => {
|
||||
onChange={event => setPossition(event.target.value)}
|
||||
defaultValue={shooterPossition}>
|
||||
<select className="dropbtn">
|
||||
<option value= "napastnik" > Napastnik </option>
|
||||
<option value = "bramkarz"> Bramkarz </option>
|
||||
<option value = "obronca"> Obrońca </option>
|
||||
<option value = "pomocnik"> Pomocnik </option>
|
||||
<option value= "Center Forward" > Napastnik </option>
|
||||
<option value = "Goalkeeper"> Bramkarz </option>
|
||||
<option value = "Left Center Back"> Obrońca </option>
|
||||
<option value = "Right Wing"> Pomocnik </option>
|
||||
|
||||
</select>
|
||||
</form>
|
||||
|
Binary file not shown.
Binary file not shown.
@ -6,9 +6,7 @@ import numpy as np
|
||||
|
||||
# Funkcja zwraca prawdopodobieństwo zdobycia gola
|
||||
def LogisticRegression_predict_proba(position_x, position_y, distance_to_goalM, angle, match_minute, Number_Intervening_Opponents, Number_Intervening_Teammates, isFoot, isHead):
|
||||
|
||||
# distance_to_goalM = sqrt(( (position_x**2) + (position_y**2)))
|
||||
|
||||
model = load('regresja_logistyczna.joblib')
|
||||
X_new = pd.DataFrame(columns=['position_x', 'position_y', 'distance_to_goalM', 'angle','match_minute', 'Number_Intervening_Opponents','Number_Intervening_Teammates', 'isFoot', 'isHead'])
|
||||
X_new.loc[len(X_new.index)] = [position_x, position_y, distance_to_goalM, angle, match_minute, Number_Intervening_Opponents, Number_Intervening_Teammates, isFoot, isHead]
|
||||
@ -132,7 +130,7 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
||||
'shot_open_goal','shot_follows_dribble', 'shot_redirect',
|
||||
'x1', 'y1','number_of_players_opponents',
|
||||
'number_of_players_teammates','angle', 'distance',
|
||||
'x_player_opponent_Goalkeeper',
|
||||
'x_player_opponent_Goalkeeper', 'x_player_opponent_8',
|
||||
'x_player_opponent_1', 'x_player_opponent_2','x_player_opponent_3',
|
||||
'x_player_opponent_4','x_player_opponent_5', 'x_player_opponent_6',
|
||||
'x_player_teammate_2','x_player_opponent_9', 'x_player_opponent_10',
|
||||
@ -169,8 +167,10 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
||||
teamMatesList = zmienWMaciez(teamMatesList)
|
||||
opponentsList = zmienWMaciez(opponentsList)
|
||||
|
||||
number_of_players_opponents = len(teamMatesList)
|
||||
number_of_players_teammates = len(opponentsList)
|
||||
|
||||
# DO ROZBUDOWY
|
||||
number_of_players_opponents = 3
|
||||
number_of_players_teammates = 3
|
||||
# Bramkarz
|
||||
x_player_opponent_Goalkeeper = goalkeeper[0]
|
||||
y_player_opponent_Goalkeeper = goalkeeper[1]
|
||||
@ -178,19 +178,16 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
||||
shot_one_on_one = True if number_of_players_opponents == 1 else False
|
||||
# TeamMate goalkeppe
|
||||
|
||||
x_player_teammate_Goalkeeper = None
|
||||
y_player_teammate_Goalkeeper = None
|
||||
x_player_teammate_Goalkeeper = np.nan
|
||||
y_player_teammate_Goalkeeper = np.nan
|
||||
#Reszta Zawodnikow
|
||||
|
||||
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
|
||||
print(X_new.head)
|
||||
X_new.loc[len(X_new.index)] = [minute, position_name, shot_body_part_name,
|
||||
shot_technique_name,shot_type_name, shot_first_time,
|
||||
shot_one_on_one,shot_aerial_won, shot_deflected,
|
||||
shot_open_goal,shot_follows_dribble, shot_redirect,
|
||||
shooter[0], shooter[1],number_of_players_opponents,
|
||||
number_of_players_teammates,angle, distance,
|
||||
x_player_opponent_Goalkeeper,
|
||||
x_player_opponent_Goalkeeper, opponentsList[8][0],
|
||||
opponentsList[0][0], opponentsList[1][0], opponentsList[2][0],
|
||||
opponentsList[3][0], opponentsList[4][0], opponentsList[5][0],
|
||||
opponentsList[6][0], opponentsList[7][0], teamMatesList[8][0],
|
||||
@ -210,10 +207,15 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
||||
x_player_teammate_Goalkeeper, y_player_teammate_Goalkeeper,
|
||||
shot_kick_off]
|
||||
|
||||
categorical_columns = ['position_name', 'shot_technique_name', 'shot_type_name', 'number_of_players_opponents', 'number_of_players_teammates', 'shot_body_part_name'] # list all your object columns here
|
||||
# X_new = pd.get_dummies(X_new, columns=categorical_columns)
|
||||
X_new[categorical_columns] = X_new[categorical_columns].astype('category')
|
||||
|
||||
return model.predict_proba(X_new)[0][1].round(2)
|
||||
|
||||
|
||||
# Pomocnicze Funkcje
|
||||
# trzeba uzupelnic
|
||||
def sortNearestToShooter(playerList, shooter):
|
||||
|
||||
return playerList
|
||||
@ -230,14 +232,14 @@ def loc2angle(x, y):
|
||||
rads = math.pi + rads if rads < 0 else rads
|
||||
deg = math.degrees(rads)
|
||||
return deg
|
||||
|
||||
# zamiana stringa odzielonego ',' na liste
|
||||
def konwertujDoListy(listaString):
|
||||
listaString = listaString.split(",")
|
||||
listaFloat = []
|
||||
for elem in listaString:
|
||||
listaFloat.append(float(elem))
|
||||
return listaFloat
|
||||
|
||||
#Zamiana listy w formie [1x,1y,2x,2y,3x,3y...] do postaci maciezy [xi, yi]
|
||||
def zmienWMaciez(lista):
|
||||
maciez = []
|
||||
for i in range(0,len(lista),2):
|
||||
@ -245,5 +247,5 @@ def zmienWMaciez(lista):
|
||||
maciez.append(player)
|
||||
if(len(maciez) < 10):
|
||||
for i in range(len(maciez),11,1):
|
||||
maciez.append([None,None])
|
||||
maciez.append([np.nan,np.nan])
|
||||
return maciez
|
Loading…
Reference in New Issue
Block a user