Compare commits
No commits in common. "master" and "modServera" have entirely different histories.
master
...
modServera
Binary file not shown.
21
README.md
21
README.md
@ -1,4 +1,4 @@
|
|||||||
# Aplikacja `CoachStats`
|
# Analiza piłkarska z aplikacją `CoachStats`
|
||||||
|
|
||||||
## Wstęp
|
## Wstęp
|
||||||
|
|
||||||
@ -9,18 +9,21 @@ CoachStats to innowacyjne narzędzie służące do analizowania statystyk Expect
|
|||||||
- **Analiza XG:** Analiza XG dla danej sytuacji meczowej.
|
- **Analiza XG:** Analiza XG dla danej sytuacji meczowej.
|
||||||
- **Personalizowana makieta:** Możliwość tworzenia własnej makiety odpowiadającej sytuacji meczowej.
|
- **Personalizowana makieta:** Możliwość tworzenia własnej makiety odpowiadającej sytuacji meczowej.
|
||||||
|
|
||||||
## Uruchomienie
|
## Technologie
|
||||||
|
|
||||||
Aby uruchomić aktualną wersję aplikacji, wykonaj następujące kroki:
|
## Instalacja i Uruchomienie
|
||||||
|
|
||||||
1. **Uruchomienie serwera:** Aby uruchomić serwer należy wejść w [link](https://sg-server-ne4h.onrender.com/) oraz zaczekać do pojawienia się komunikatu o błędzie 404. Aplikacja korzysta z darmowej wersji obsługi serwera, stąd sposób jego uruchomienia nie jest standardowy.
|
Aby uruchomić beta wersję aplikacji, wykonaj następujące kroki:
|
||||||
|
|
||||||
2. **Uruchomienie aplikacji webowej** Po wykonaiu kroku 1 można wejść na właściwą stronę [aplikacji](https://statgoals.onrender.com/).
|
1. **Uruchomienie Klienta:**
|
||||||
|
Otwórz terminal w folderze `app` i uruchom następującą komendę:\
|
||||||
|
`npm run dev`
|
||||||
|
|
||||||
|
2. **Uruchomienie Serwera Flask:**
|
||||||
|
W innym terminalu, przejdź do folderu `app/src/flask-server` i uruchom serwer Flask przy użyciu poniższej komendy:\
|
||||||
|
`python server.py`
|
||||||
|
|
||||||
|
|
||||||
## Dane
|
## Dane
|
||||||
|
|
||||||
- <https://statsbomb.com/what-we-do/soccer-data/>
|
- <https://statsbomb.com/what-we-do/soccer-data/>
|
||||||
|
|
||||||
## Szczegóły
|
|
||||||
|
|
||||||
Działanie aplikacji zostało opisane w podręczniku użytkownika znajdującym się w drzewie plików na repozytorium. Poza tym odsyłam do [repozytorium](https://git.wmi.amu.edu.pl/s478993/fantastyczne_gole) uniwersytetu na którym powstała aplikacja. Zawiera ono kod źródłowy aplikacji.
|
|
||||||
|
@ -5,49 +5,11 @@ import { Link } from "react-router-dom";
|
|||||||
|
|
||||||
const Hero = () => {
|
const Hero = () => {
|
||||||
|
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [gameMinute, setGameMinute] = useState('');
|
const [gameMinute, setGameMinute] = useState('');
|
||||||
|
|
||||||
const [firstShot, setfirstShot] = useState(0);
|
const toggleDropdown = () => setIsOpen(!isOpen);
|
||||||
const [oneOnOne, SetoneOnOne] = useState(0);
|
const handleMinuteChange = (e) => setGameMinute(e.target.value);
|
||||||
const [afterAirDuel, SetafterAirDuele] = useState(0);
|
|
||||||
const [openGoal, SetOpenGoal] = useState(0);
|
|
||||||
const [afterDribbling, SetafterDribbling] = useState(0);
|
|
||||||
const [redirect, SetRedirect] = useState(0);
|
|
||||||
|
|
||||||
const handleMinuteChange = (e) => { setGameMinute(e.target.value);
|
|
||||||
//sentQuestion();
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleFirstShotChange = (event) => {
|
|
||||||
setfirstShot(event.target.checked);
|
|
||||||
//sentQuestion();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOneOnOneChange = (event) => {
|
|
||||||
SetoneOnOne(event.target.checked);
|
|
||||||
//sentQuestion();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAfterAirDuelChange = (event) => {
|
|
||||||
SetafterAirDuele(event.target.checked);
|
|
||||||
//sentQuestion();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOpenGoalChange = (event) => {
|
|
||||||
SetOpenGoal(event.target.checked);
|
|
||||||
//sentQuestion();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAfterDribblingChange = (event) => {
|
|
||||||
SetafterDribbling(event.target.checked);
|
|
||||||
//sentQuestion();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleRedirectChange = (event) => {
|
|
||||||
SetRedirect(event.target.checked);
|
|
||||||
//sentQuestion();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const [data, setData] = useState("");
|
const [data, setData] = useState("");
|
||||||
//zmienne globalne
|
//zmienne globalne
|
||||||
@ -55,24 +17,10 @@ const handleRedirectChange = (event) => {
|
|||||||
//przez listener nanoszący zawodników na boisko. 1 - strzelec , 2 - bramkarz , 3 - obronca, 4 - napasnik. zmienna przez aktywacje przycskówk bb1, bb2, bb3 i bb4
|
//przez listener nanoszący zawodników na boisko. 1 - strzelec , 2 - bramkarz , 3 - obronca, 4 - napasnik. zmienna przez aktywacje przycskówk bb1, bb2, bb3 i bb4
|
||||||
|
|
||||||
let active_bbt = "bbt1";
|
let active_bbt = "bbt1";
|
||||||
const [number_of_defenders, setNumberOfDevenders] = useState(()=>{
|
const [number_of_defenders, setNumberOfDevenders] = useState(0);
|
||||||
return 0;
|
const [number_of_strikers, setNumberOfStrikers] = useState(0)
|
||||||
});
|
const [number_of_goalkeepers, setNumberOfGoalkeppers] = useState(0);
|
||||||
|
const [number_of_shooters,setNumberOfShooters] = useState(0);
|
||||||
const [number_of_strikers, setNumberOfStrikers] = useState(() => {
|
|
||||||
return 0;
|
|
||||||
})
|
|
||||||
const [number_of_goalkeepers, setNumberOfGoalkeppers] = useState(()=>{
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
const [number_of_shooters,setNumberOfShooters] = useState(() => {
|
|
||||||
return 0}
|
|
||||||
);
|
|
||||||
|
|
||||||
const number_of_shooters_rev = React.useRef(number_of_shooters)
|
|
||||||
const number_of_strikers_rev = React.useRef(number_of_strikers)
|
|
||||||
const number_of_goalkeepers_rev = React.useRef(number_of_goalkeepers)
|
|
||||||
const number_of_defenders_rev = React.useRef(number_of_defenders)
|
|
||||||
|
|
||||||
// zmienne globalne bedace danymi wejsciowymi do modelu
|
// zmienne globalne bedace danymi wejsciowymi do modelu
|
||||||
|
|
||||||
@ -109,6 +57,7 @@ const handleRedirectChange = (event) => {
|
|||||||
|
|
||||||
// Reset Boiska
|
// Reset Boiska
|
||||||
function resetField() {
|
function resetField() {
|
||||||
|
|
||||||
var footballField = document.getElementById('footballField');
|
var footballField = document.getElementById('footballField');
|
||||||
var footballs = document.querySelectorAll('.football');
|
var footballs = document.querySelectorAll('.football');
|
||||||
var list = document.getElementById('list')
|
var list = document.getElementById('list')
|
||||||
@ -120,20 +69,13 @@ const handleRedirectChange = (event) => {
|
|||||||
players.forEach(function(element) {
|
players.forEach(function(element) {
|
||||||
list.removeChild(element);
|
list.removeChild(element);
|
||||||
})
|
})
|
||||||
|
|
||||||
setNumberOfDevenders(0);
|
setNumberOfDevenders(0);
|
||||||
setNumberOfStrikers(0)
|
setNumberOfStrikers(0)
|
||||||
setNumberOfGoalkeppers(0)
|
setNumberOfGoalkeppers(0)
|
||||||
setNumberOfShooters(0)
|
setNumberOfShooters(0)
|
||||||
setGameMinute('')
|
|
||||||
|
|
||||||
number_of_shooters_rev.current = 0;
|
|
||||||
number_of_goalkeepers_rev.current = 0;
|
|
||||||
number_of_defenders_rev.current = 0;
|
|
||||||
number_of_strikers_rev.current = 0;
|
|
||||||
|
|
||||||
document.getElementById("ex").innerHTML = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//funkcja dodaje zawodnika do listy zawodnikow. zmienne x oraz y to wspolrzedne a position
|
//funkcja dodaje zawodnika do listy zawodnikow. zmienne x oraz y to wspolrzedne a position
|
||||||
// to pozycja zawodnika 0 - strzelec, 1 - bramkarz, 2 - broniacy, 3 napastnik
|
// to pozycja zawodnika 0 - strzelec, 1 - bramkarz, 2 - broniacy, 3 napastnik
|
||||||
// ball - to odnosnik do punktu na boisku
|
// ball - to odnosnik do punktu na boisku
|
||||||
@ -144,15 +86,14 @@ const handleRedirectChange = (event) => {
|
|||||||
list.removeChild(player)
|
list.removeChild(player)
|
||||||
bojo.removeChild(ball)
|
bojo.removeChild(ball)
|
||||||
if(possition == 1){
|
if(possition == 1){
|
||||||
setNumberOfGoalkeppers(number_of_goalkeepers_rev.current -= 1);
|
setNumberOfGoalkeppers(0)
|
||||||
}else if(possition == 2){
|
}else if(possition == 2){
|
||||||
setNumberOfDevenders(number_of_defenders_rev.current -= 1) ;
|
setNumberOfDevenders(number_of_defenders-1) ;
|
||||||
}else if (possition == 3){
|
}else if (possition == 3){
|
||||||
setNumberOfStrikers(number_of_strikers_rev.current -= 1);
|
setNumberOfStrikers(number_of_strikers-1) ;
|
||||||
}else if(possition == 0){
|
}else if(possition == 0){
|
||||||
setNumberOfShooters(number_of_shooters_rev.current -= 1);
|
setNumberOfShooters(0)
|
||||||
}
|
}
|
||||||
//sentQuestion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// funkcja zsczytuje pozycje zawodnikow przed wyslaniem zapytania do serwera
|
// funkcja zsczytuje pozycje zawodnikow przed wyslaniem zapytania do serwera
|
||||||
@ -186,22 +127,19 @@ const handleRedirectChange = (event) => {
|
|||||||
var pName = "Strzelec"
|
var pName = "Strzelec"
|
||||||
//kolor kropki
|
//kolor kropki
|
||||||
// kolor tła kafelka
|
// kolor tła kafelka
|
||||||
|
|
||||||
var pColor = "#fc0303"
|
var pColor = "#fc0303"
|
||||||
if(possition == 1){
|
if(possition == 1){
|
||||||
var pName = "Bramkarz"
|
var pName = "Bramkarz"
|
||||||
var pColor = "#03e7fc"
|
var pColor = "#03e7fc"
|
||||||
setNumberOfGoalkeppers(number_of_goalkeepers_rev.current += 1);
|
|
||||||
}else if(possition == 2){
|
}else if(possition == 2){
|
||||||
var pName = "Obrońca"
|
var pName = "Obrońca"
|
||||||
var pColor = "#0324fc"
|
var pColor = "#0324fc"
|
||||||
setNumberOfDevenders(number_of_defenders_rev.current += 1);
|
|
||||||
}else if (possition ==3){
|
}else if (possition ==3){
|
||||||
var pName = "Napastnik"
|
var pName = "Napastnik"
|
||||||
var pColor = "#fc6703"
|
var pColor = "#fc6703"
|
||||||
setNumberOfStrikers(number_of_strikers_rev.current += 1);
|
|
||||||
}else{
|
|
||||||
setNumberOfShooters(number_of_shooters_rev.current += 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var player = document.createElement('div');
|
var player = document.createElement('div');
|
||||||
player.className = 'player';
|
player.className = 'player';
|
||||||
player.style.width = "inherit"
|
player.style.width = "inherit"
|
||||||
@ -216,7 +154,7 @@ const handleRedirectChange = (event) => {
|
|||||||
// div z pozycja gracza
|
// div z pozycja gracza
|
||||||
var posytion = document.createElement('div')
|
var posytion = document.createElement('div')
|
||||||
posytion.style.fontSize = "12px"
|
posytion.style.fontSize = "12px"
|
||||||
posytion.innerHTML = konwerturX(ball.style.left) + " m, " + konwetujY(ball.style.top) + " m";
|
posytion.innerHTML = "Lokalizacja: " + konwerturX(ball.style.left) + " m, " + konwetujY(ball.style.top) + " m";
|
||||||
player.setAttribute('possition',[konwerturX(ball.style.left),konwetujY(ball.style.top)])
|
player.setAttribute('possition',[konwerturX(ball.style.left),konwetujY(ball.style.top)])
|
||||||
//div z przyciskiem usuwającym
|
//div z przyciskiem usuwającym
|
||||||
var btnDelete = document.createElement('button')
|
var btnDelete = document.createElement('button')
|
||||||
@ -271,8 +209,8 @@ const handleRedirectChange = (event) => {
|
|||||||
tekst.style.color = "white"
|
tekst.style.color = "white"
|
||||||
posytion.style.color = "white"
|
posytion.style.color = "white"
|
||||||
|
|
||||||
x = parseFloat(x) -3
|
x = parseFloat(x) -2
|
||||||
y = parseFloat(y) -3
|
y = parseFloat(y) -2
|
||||||
|
|
||||||
if(bojo.parentNode.querySelector(":hover")){
|
if(bojo.parentNode.querySelector(":hover")){
|
||||||
ball.style.left = x + "%"
|
ball.style.left = x + "%"
|
||||||
@ -281,29 +219,32 @@ const handleRedirectChange = (event) => {
|
|||||||
//var shooterX = konwerturX(ball.style.left)
|
//var shooterX = konwerturX(ball.style.left)
|
||||||
//var shooterY = konwetujY(ball.style.top)
|
//var shooterY = konwetujY(ball.style.top)
|
||||||
posytion.innerHTML = "x:" + konwerturX(ball.style.left) + "m " + "y:" + konwetujY(ball.style.top) + "m";
|
posytion.innerHTML = "x:" + konwerturX(ball.style.left) + "m " + "y:" + konwetujY(ball.style.top) + "m";
|
||||||
player.setAttribute('possition',[konwerturX(ball.style.left),konwetujY(ball.style.top)]);
|
//player.setAttribute('possition',[konwerturX(ball.style.left),konwetujY(ball.style.top)]);
|
||||||
bojo.addEventListener("mouseup", function afterUp(){
|
bojo.addEventListener("mouseup", function(){
|
||||||
ball.style.background = pColor
|
ball.style.background = pColor
|
||||||
bojo.removeEventListener("mousemove", whileMove)
|
bojo.removeEventListener("mousemove", whileMove)
|
||||||
bojo.removeEventListener("mouseup", afterUp)
|
|
||||||
})
|
})
|
||||||
})
|
|
||||||
bojo.addEventListener("mouseup", function reload(){
|
})
|
||||||
//sentQuestion();
|
|
||||||
bojo.removeEventListener("mouseup",reload)
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
})
|
||||||
//sentQuestion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateXGMeter(xgValue) {
|
||||||
|
var xgMeter = document.querySelector('.xg-meter');
|
||||||
|
var greenIntensity = xgValue * 100; // Zakładając, że xgValue jest między 0 a 1
|
||||||
|
//xgMeter.style.background = `linear-gradient(to top, #006400 ${greenIntensity}%, #90EE90)`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// // Wyłanie zapytania do serwera
|
// // Wyłanie zapytania do serwera
|
||||||
function sentQuestion() {
|
function sentQuestion() {
|
||||||
///Dziwny Blad
|
///Dziwny Blad
|
||||||
loadPlayers()
|
loadPlayers()
|
||||||
if (number_of_shooters_rev.current == 1) {
|
if (number_of_shooters == 1) {
|
||||||
//console.log('Wysyłanie wartości: ', bodyPart, technique, actionType, shooterPossition, gameMinute, firstShot);
|
console.log('Wysyłanie wartości: ', bodyPart, technique);
|
||||||
// Użyj backticksów zamiast zwykłych cudzysłowów
|
// Użyj backticksów zamiast zwykłych cudzysłowów
|
||||||
fetch(`http://127.0.0.1:5000/get_model?shooter=${shooter}&goalkeeper=${goalkeeper}&defenders=${defenders}&strickers=${stricers}&bodyPart=${bodyPart}&technique=${technique}&actionType=${actionType}&shooterPossition=${shooterPossition}&gameMinute=${gameMinute}&shot_first_time=${firstShot}&shot_one_on_one=${oneOnOne}&shot_aerial_won=${afterAirDuel}&shot_open_goal=${openGoal}&shot_follows_dribble=${afterDribbling}&shot_redirect=${redirect}`).then(
|
fetch(`http://127.0.0.1:5000/get_model?shooter=${shooter}&goalkeeper=${goalkeeper}&defenders=${defenders}&strickers=${stricers}&bodyPart=${bodyPart}&technique=${technique}&actionType=${actionType}&shooterPossition=${shooterPossition}`).then(
|
||||||
res => res.json()
|
res => res.json()
|
||||||
).then(
|
).then(
|
||||||
data => {
|
data => {
|
||||||
@ -312,7 +253,7 @@ const handleRedirectChange = (event) => {
|
|||||||
// Przenieś tę linię do środka bloku .then(), aby uniknąć błędów
|
// Przenieś tę linię do środka bloku .then(), aby uniknąć błędów
|
||||||
let eX = data.response;
|
let eX = data.response;
|
||||||
document.getElementById("ex").innerHTML = eX;
|
document.getElementById("ex").innerHTML = eX;
|
||||||
//updateXGMeter(eX);
|
updateXGMeter(eX);
|
||||||
}
|
}
|
||||||
).catch(error => {
|
).catch(error => {
|
||||||
console.error('Błąd:', error);
|
console.error('Błąd:', error);
|
||||||
@ -320,9 +261,10 @@ const handleRedirectChange = (event) => {
|
|||||||
} else {
|
} else {
|
||||||
alert('Piłka nie jest obecnie na boisku.');
|
alert('Piłka nie jest obecnie na boisku.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Funkcja dodająca listener do boiska*/
|
/* Funkcja dodająca listener do boiska*/
|
||||||
@ -343,30 +285,36 @@ const handleRedirectChange = (event) => {
|
|||||||
//dodanie zawodnika do listy oraz punktu do mapy w zaleznosci od aktywnosci przycisku 1,2,3 lub 4
|
//dodanie zawodnika do listy oraz punktu do mapy w zaleznosci od aktywnosci przycisku 1,2,3 lub 4
|
||||||
|
|
||||||
if(active_bbt=="bbt1"){
|
if(active_bbt=="bbt1"){
|
||||||
if(number_of_shooters_rev.current < 1 ){
|
if(number_of_shooters < 1 ){
|
||||||
addPlayer(0,ball)
|
addPlayer(0,ball)
|
||||||
bojo.appendChild(ball)
|
bojo.appendChild(ball)
|
||||||
ball.style.background = "#fc0303"
|
ball.style.background = "#fc0303"
|
||||||
|
setNumberOfShooters(number_of_shooters+1)
|
||||||
}else{alert("mozesz dodac tylko jednego strzelca")}
|
}else{alert("mozesz dodac tylko jednego strzelca")}
|
||||||
}else if(active_bbt == "bbt2"){
|
}else if(active_bbt == "bbt2"){
|
||||||
if ( number_of_goalkeepers_rev.current < 1){
|
if ( number_of_goalkeepers < 1){
|
||||||
addPlayer(1,ball)
|
addPlayer(1,ball)
|
||||||
bojo.appendChild(ball)
|
bojo.appendChild(ball)
|
||||||
ball.style.background = "#03e7fc"
|
ball.style.background = "#03e7fc"
|
||||||
|
setNumberOfGoalkeppers(number_of_goalkeepers+1)
|
||||||
}else{alert("mozesz dodac tylko jednego bramkarza")}
|
}else{alert("mozesz dodac tylko jednego bramkarza")}
|
||||||
}else if(active_bbt == "bbt3"){
|
}else if(active_bbt == "bbt3"){
|
||||||
if(number_of_defenders_rev.current < 10){
|
if(number_of_defenders <= 10){
|
||||||
addPlayer(2,ball);
|
addPlayer(2,ball);
|
||||||
|
setNumberOfDevenders(number_of_defenders+1)
|
||||||
bojo.appendChild(ball)
|
bojo.appendChild(ball)
|
||||||
ball.style.background = "#0324fc"
|
ball.style.background = "#0324fc"
|
||||||
}else{alert("maksymalna liczba obroncow")}
|
}else{alert("maksymalna liczba obroncow")}
|
||||||
}else if(active_bbt == "bbt4"){
|
}else if(active_bbt == "bbt4"){
|
||||||
if(number_of_strikers_rev.current < 10){
|
if(number_of_strikers <= 10){
|
||||||
addPlayer(3,ball);
|
addPlayer(3,ball);
|
||||||
|
setNumberOfStrikers(number_of_strikers+1);
|
||||||
bojo.appendChild(ball)
|
bojo.appendChild(ball)
|
||||||
ball.style.background = "#fc6703"
|
ball.style.background = "#fc6703"
|
||||||
}else{alert("maksymalna liczba napastnikow")}
|
}else{alert("maksymalna liczba napastnikow")}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// funkcja działą po utworzeniu komponentów, dodaje listenry do elementów
|
// funkcja działą po utworzeniu komponentów, dodaje listenry do elementów
|
||||||
|
|
||||||
@ -395,13 +343,11 @@ const handleRedirectChange = (event) => {
|
|||||||
<div className="container">
|
<div className="container">
|
||||||
{/* Listy zwijane */}
|
{/* Listy zwijane */}
|
||||||
|
|
||||||
<div className="top-bar" id = "top-bar">
|
<div className="top-bar">
|
||||||
|
|
||||||
<form className="dropdown" id = "bodyPartList">
|
<form className="dropdown" id = "bodyPartList">
|
||||||
<select className="dropbtn"
|
<select className="dropbtn"
|
||||||
onChange={event => {setBodyPart(event.target.value);
|
onChange={event => setBodyPart(event.target.value)}
|
||||||
//sentQuestion()
|
|
||||||
}}
|
|
||||||
defaultValue={bodyPart}>
|
defaultValue={bodyPart}>
|
||||||
<option value = "Right Foot">Noga Prawa</option>
|
<option value = "Right Foot">Noga Prawa</option>
|
||||||
<option value = "Left Foot">Noga Lewa</option>
|
<option value = "Left Foot">Noga Lewa</option>
|
||||||
@ -414,9 +360,7 @@ const handleRedirectChange = (event) => {
|
|||||||
|
|
||||||
|
|
||||||
<form className="dropdown" id = "shootTypeList">
|
<form className="dropdown" id = "shootTypeList">
|
||||||
<select className="dropbtn" onChange={event => {setTechnique(event.target.value);
|
<select className="dropbtn" onChange={event => setTechnique(event.target.value)}
|
||||||
//sentQuestion()
|
|
||||||
}}
|
|
||||||
defaultValue = {technique}>
|
defaultValue = {technique}>
|
||||||
<option value="Normal"> Zwykły </option>
|
<option value="Normal"> Zwykły </option>
|
||||||
<option value = "Volley"> Wolej </option>
|
<option value = "Volley"> Wolej </option>
|
||||||
@ -428,9 +372,7 @@ const handleRedirectChange = (event) => {
|
|||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form className="dropdown" id = "actionTypeList" onChange={event => {setActionType(event.target.value);
|
<form className="dropdown" id = "actionTypeList" onChange={event => setActionType(event.target.value)}
|
||||||
//sentQuestion()
|
|
||||||
}}
|
|
||||||
defaultValue={technique}>
|
defaultValue={technique}>
|
||||||
<select className="dropbtn">
|
<select className="dropbtn">
|
||||||
<option value = "Open Play"> Atak Pozycyjny </option>
|
<option value = "Open Play"> Atak Pozycyjny </option>
|
||||||
@ -440,9 +382,7 @@ const handleRedirectChange = (event) => {
|
|||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
<form className="dropdown" id = "possitionList"
|
<form className="dropdown" id = "possitionList"
|
||||||
onChange={event => {setPossition(event.target.value);
|
onChange={event => setPossition(event.target.value)}
|
||||||
//sentQuestion()
|
|
||||||
}}
|
|
||||||
defaultValue={shooterPossition}>
|
defaultValue={shooterPossition}>
|
||||||
<select className="dropbtn">
|
<select className="dropbtn">
|
||||||
<option value="Right Center Forward">Prawy Środkowy Napastnik</option>
|
<option value="Right Center Forward">Prawy Środkowy Napastnik</option>
|
||||||
@ -495,40 +435,55 @@ const handleRedirectChange = (event) => {
|
|||||||
<div className="field-pic"></div>
|
<div className="field-pic"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="rightMenu">
|
|
||||||
<div className="xg-meter">
|
|
||||||
<b id="ex" className="xg-value">0</b>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="additional-parameters">
|
<div className="additional-parameters">
|
||||||
<h3>Parametry strzału</h3>
|
<h3>Parametry strzału</h3>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="firstShot" onChange={handleFirstShotChange} />
|
<input type="checkbox" id="firstShot" />
|
||||||
Pierwszy w meczu
|
Pierwszy w meczu
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="oneOnOne" onChange={handleOneOnOneChange} />
|
<input type="checkbox" id="oneOnOne" />
|
||||||
Akcja sam na sam
|
Akcja sam na sam
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="afterAirDuel" onChange={handleAfterAirDuelChange} />
|
<input type="checkbox" id="afterAirDuel" />
|
||||||
Po pojedynku powietrznym
|
Po pojedynku powietrznym
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="openGoal" onChange={handleOpenGoalChange} />
|
<input type="checkbox" id="openGoal" />
|
||||||
Na pustą bramkę
|
Na pustą bramkę
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="afterDribbling" onChange={handleAfterDribblingChange} />
|
<input type="checkbox" id="afterDribbling" />
|
||||||
Poprzedzony dryblingiem
|
Poprzedzony dryblingiem
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="redirect" onChange={handleRedirectChange} />
|
<input type="checkbox" id="ricochet" />
|
||||||
Rykoszet
|
Rykoszet
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* <div className="ChoosingPlayer">
|
||||||
|
<button className="cho-one_on_one" id = "bbt8">Sam na sam</button>
|
||||||
|
</div>
|
||||||
|
<div className="ChoosingPlayer">
|
||||||
|
<button className="cho-first_time" id = "bbt12">Pierwszy w meczu</button>
|
||||||
|
</div>
|
||||||
|
<div className="ChoosingPlayer">
|
||||||
|
<button className="cho-aerial_won" id = "bbt13">Pojedynek powietrzny</button>
|
||||||
|
</div>
|
||||||
|
<div className="ChoosingPlayer">
|
||||||
|
<button className="cho-follows_dribble" id = "bbt14">Drybling</button>
|
||||||
|
</div>
|
||||||
|
<div className="ChoosingPlayer">
|
||||||
|
<button className="cho-redirect" id = "bbt15">Rykoszet</button>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
<div className="bottom-bar">
|
<div className="bottom-bar">
|
||||||
|
|
||||||
<button className="cho-shooter" id = "bbt1">Strzelec</button>
|
<button className="cho-shooter" id = "bbt1">Strzelec</button>
|
||||||
@ -538,6 +493,9 @@ const handleRedirectChange = (event) => {
|
|||||||
<button className="reset-button" onClick={resetField}>Reset</button>
|
<button className="reset-button" onClick={resetField}>Reset</button>
|
||||||
<button className="info-button" onClick={sentQuestion}>xG</button>
|
<button className="info-button" onClick={sentQuestion}>xG</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="xg-meter">
|
||||||
|
<b id="ex" class="xg-value"></b>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,8 +3,6 @@ import pandas as pd
|
|||||||
from math import sqrt
|
from math import sqrt
|
||||||
import math
|
import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import xgboost
|
|
||||||
from sklearn.preprocessing import OrdinalEncoder
|
|
||||||
|
|
||||||
# Funkcja zwraca prawdopodobieństwo zdobycia gola
|
# 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):
|
def LogisticRegression_predict_proba(position_x, position_y, distance_to_goalM, angle, match_minute, Number_Intervening_Opponents, Number_Intervening_Teammates, isFoot, isHead):
|
||||||
@ -17,7 +15,7 @@ def LogisticRegression_predict_proba(position_x, position_y, distance_to_goalM,
|
|||||||
#xgBoost
|
#xgBoost
|
||||||
def xgboost_predict_proba(minute=0, position_name='Center Forward', shot_body_part_name='Right Foot',
|
def xgboost_predict_proba(minute=0, position_name='Center Forward', shot_body_part_name='Right Foot',
|
||||||
shot_technique_name='Normal', shot_type_name='Open Play', shot_first_time=False,
|
shot_technique_name='Normal', shot_type_name='Open Play', shot_first_time=False,
|
||||||
shot_one_on_one=False, shot_aerial_won=False,
|
shot_one_on_one=False, shot_aerial_won=False, shot_deflected=False,
|
||||||
shot_open_goal=False, shot_follows_dribble=False, shot_redirect=False, x1=0.0, y1=0.0,
|
shot_open_goal=False, shot_follows_dribble=False, shot_redirect=False, x1=0.0, y1=0.0,
|
||||||
number_of_players_opponents=0, number_of_players_teammates=0,
|
number_of_players_opponents=0, number_of_players_teammates=0,
|
||||||
angle=0.0, distance=0.0, x_player_opponent_Goalkeeper=np.nan,
|
angle=0.0, distance=0.0, x_player_opponent_Goalkeeper=np.nan,
|
||||||
@ -36,17 +34,13 @@ def xgboost_predict_proba(minute=0, position_name='Center Forward', shot_body_pa
|
|||||||
y_player_teammate_4=np.nan, y_player_teammate_5=np.nan, y_player_teammate_6=np.nan,
|
y_player_teammate_4=np.nan, y_player_teammate_5=np.nan, y_player_teammate_6=np.nan,
|
||||||
y_player_teammate_7=np.nan, y_player_teammate_8=np.nan, y_player_teammate_9=np.nan,
|
y_player_teammate_7=np.nan, y_player_teammate_8=np.nan, y_player_teammate_9=np.nan,
|
||||||
y_player_teammate_10=np.nan, x_player_opponent_7=np.nan, y_player_opponent_7=np.nan,
|
y_player_teammate_10=np.nan, x_player_opponent_7=np.nan, y_player_opponent_7=np.nan,
|
||||||
x_player_teammate_Goalkeeper=np.nan, y_player_teammate_Goalkeeper=np.nan):
|
x_player_teammate_Goalkeeper=np.nan, y_player_teammate_Goalkeeper=np.nan, shot_kick_off=False):
|
||||||
|
|
||||||
model = xgboost.XGBClassifier()
|
model = load('xgboost.joblib')
|
||||||
model.load_model('xgboost.json')
|
|
||||||
|
|
||||||
enc = OrdinalEncoder()
|
|
||||||
enc = load('labelEncoder.joblib')
|
|
||||||
|
|
||||||
X_new = pd.DataFrame(columns=['minute', 'position_name', 'shot_body_part_name', 'shot_technique_name',
|
X_new = pd.DataFrame(columns=['minute', 'position_name', 'shot_body_part_name', 'shot_technique_name',
|
||||||
'shot_type_name', 'shot_first_time', 'shot_one_on_one',
|
'shot_type_name', 'shot_first_time', 'shot_one_on_one',
|
||||||
'shot_aerial_won', 'shot_open_goal',
|
'shot_aerial_won', 'shot_deflected', 'shot_open_goal',
|
||||||
'shot_follows_dribble', 'shot_redirect', 'x1', 'y1',
|
'shot_follows_dribble', 'shot_redirect', 'x1', 'y1',
|
||||||
'number_of_players_opponents', 'number_of_players_teammates',
|
'number_of_players_opponents', 'number_of_players_teammates',
|
||||||
'angle', 'distance', 'x_player_opponent_Goalkeeper',
|
'angle', 'distance', 'x_player_opponent_Goalkeeper',
|
||||||
@ -65,11 +59,12 @@ def xgboost_predict_proba(minute=0, position_name='Center Forward', shot_body_pa
|
|||||||
'y_player_teammate_4', 'y_player_teammate_5', 'y_player_teammate_6',
|
'y_player_teammate_4', 'y_player_teammate_5', 'y_player_teammate_6',
|
||||||
'y_player_teammate_7', 'y_player_teammate_8', 'y_player_teammate_9',
|
'y_player_teammate_7', 'y_player_teammate_8', 'y_player_teammate_9',
|
||||||
'y_player_teammate_10', 'x_player_opponent_7', 'y_player_opponent_7',
|
'y_player_teammate_10', 'x_player_opponent_7', 'y_player_opponent_7',
|
||||||
'x_player_teammate_Goalkeeper', 'y_player_teammate_Goalkeeper'])
|
'x_player_teammate_Goalkeeper', 'y_player_teammate_Goalkeeper',
|
||||||
|
'shot_kick_off'])
|
||||||
|
|
||||||
X_new.loc[len(X_new.index)] = [minute, position_name, shot_body_part_name, shot_technique_name,
|
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_type_name, shot_first_time, shot_one_on_one,
|
||||||
shot_aerial_won, shot_open_goal,
|
shot_aerial_won, shot_deflected, shot_open_goal,
|
||||||
shot_follows_dribble, shot_redirect, x1, y1,
|
shot_follows_dribble, shot_redirect, x1, y1,
|
||||||
number_of_players_opponents, number_of_players_teammates,
|
number_of_players_opponents, number_of_players_teammates,
|
||||||
angle, distance, x_player_opponent_Goalkeeper,
|
angle, distance, x_player_opponent_Goalkeeper,
|
||||||
@ -88,67 +83,50 @@ def xgboost_predict_proba(minute=0, position_name='Center Forward', shot_body_pa
|
|||||||
y_player_teammate_4, y_player_teammate_5, y_player_teammate_6,
|
y_player_teammate_4, y_player_teammate_5, y_player_teammate_6,
|
||||||
y_player_teammate_7, y_player_teammate_8, y_player_teammate_9,
|
y_player_teammate_7, y_player_teammate_8, y_player_teammate_9,
|
||||||
y_player_teammate_10, x_player_opponent_7, y_player_opponent_7,
|
y_player_teammate_10, x_player_opponent_7, y_player_opponent_7,
|
||||||
x_player_teammate_Goalkeeper, y_player_teammate_Goalkeeper]
|
x_player_teammate_Goalkeeper, y_player_teammate_Goalkeeper,
|
||||||
|
shot_kick_off]
|
||||||
|
|
||||||
X_new[['position_name',
|
X_new[['position_name',
|
||||||
'shot_technique_name',
|
|
||||||
'shot_type_name',
|
|
||||||
'shot_body_part_name']] = enc.transform(X_new[['position_name', 'shot_technique_name', 'shot_type_name', 'shot_body_part_name']], )
|
|
||||||
|
|
||||||
X_new[['minute',
|
|
||||||
'position_name',
|
|
||||||
'shot_technique_name',
|
'shot_technique_name',
|
||||||
'shot_type_name',
|
'shot_type_name',
|
||||||
'number_of_players_opponents',
|
'number_of_players_opponents',
|
||||||
'number_of_players_teammates',
|
'number_of_players_teammates',
|
||||||
'shot_body_part_name']] = X_new[['minute',
|
'shot_body_part_name']] = X_new[['position_name',
|
||||||
'position_name',
|
|
||||||
'shot_technique_name',
|
'shot_technique_name',
|
||||||
'shot_type_name',
|
'shot_type_name',
|
||||||
'number_of_players_opponents',
|
'number_of_players_opponents',
|
||||||
'number_of_players_teammates',
|
'number_of_players_teammates',
|
||||||
'shot_body_part_name']].astype(int)
|
'shot_body_part_name']].astype('category')
|
||||||
|
|
||||||
# X_new[['minute',
|
|
||||||
# 'position_name',
|
|
||||||
# 'shot_technique_name',
|
|
||||||
# 'shot_type_name',
|
|
||||||
# 'number_of_players_opponents',
|
|
||||||
# 'number_of_players_teammates',
|
|
||||||
# 'shot_body_part_name']] = X_new[['minute',
|
|
||||||
# 'position_name',
|
|
||||||
# 'shot_technique_name',
|
|
||||||
# 'shot_type_name',
|
|
||||||
# 'number_of_players_opponents',
|
|
||||||
# 'number_of_players_teammates',
|
|
||||||
# 'shot_body_part_name']].astype('category')
|
|
||||||
|
|
||||||
|
X_new['minute'] = X_new['minute'].astype(int)
|
||||||
|
|
||||||
X_new[['shot_first_time',
|
X_new[['shot_first_time',
|
||||||
'shot_one_on_one',
|
'shot_one_on_one',
|
||||||
'shot_aerial_won',
|
'shot_aerial_won',
|
||||||
|
'shot_deflected',
|
||||||
'shot_open_goal',
|
'shot_open_goal',
|
||||||
'shot_follows_dribble',
|
'shot_follows_dribble',
|
||||||
'shot_redirect']] = X_new[['shot_first_time',
|
'shot_redirect',
|
||||||
|
'shot_kick_off']] = X_new[['shot_first_time',
|
||||||
'shot_one_on_one',
|
'shot_one_on_one',
|
||||||
'shot_aerial_won',
|
'shot_aerial_won',
|
||||||
|
'shot_deflected',
|
||||||
'shot_open_goal',
|
'shot_open_goal',
|
||||||
'shot_follows_dribble',
|
'shot_follows_dribble',
|
||||||
'shot_redirect']].astype(int)
|
'shot_redirect',
|
||||||
print(X_new)
|
'shot_kick_off']].astype(bool)
|
||||||
print(X_new.dtypes)
|
|
||||||
|
|
||||||
|
|
||||||
return model.predict_proba(X_new)[0][1].round(3)
|
return model.predict_proba(X_new)[0][1].round(3)
|
||||||
|
|
||||||
#XgBoost_2
|
#XgBoost_2
|
||||||
|
|
||||||
def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, minute,position_name,shot_body_part_name,
|
def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, minute,position_name,shot_body_part_name,
|
||||||
shot_technique_name,shot_type_name,shot_first_time,shot_aerial_won,shot_open_goal,
|
shot_technique_name,shot_type_name,shot_first_time,shot_aerial_won,shot_deflected,shot_open_goal,
|
||||||
shot_follows_dribble,shot_redirect):
|
shot_follows_dribble,shot_redirect, shot_kick_off):
|
||||||
model = load('xgboost.joblib')
|
model = load('xgboost.joblib')
|
||||||
X_new = pd.DataFrame(columns=['minute', 'position_name', 'shot_body_part_name',
|
X_new = pd.DataFrame(columns=['minute', 'position_name', 'shot_body_part_name',
|
||||||
'shot_technique_name','shot_type_name', 'shot_first_time',
|
'shot_technique_name','shot_type_name', 'shot_first_time',
|
||||||
'shot_one_on_one','shot_aerial_won',
|
'shot_one_on_one','shot_aerial_won', 'shot_deflected',
|
||||||
'shot_open_goal','shot_follows_dribble', 'shot_redirect',
|
'shot_open_goal','shot_follows_dribble', 'shot_redirect',
|
||||||
'x1', 'y1','number_of_players_opponents',
|
'x1', 'y1','number_of_players_opponents',
|
||||||
'number_of_players_teammates','angle', 'distance',
|
'number_of_players_teammates','angle', 'distance',
|
||||||
@ -168,7 +146,8 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
|||||||
'y_player_teammate_4', 'y_player_teammate_5', 'y_player_teammate_6',
|
'y_player_teammate_4', 'y_player_teammate_5', 'y_player_teammate_6',
|
||||||
'y_player_teammate_7', 'y_player_teammate_8', 'y_player_teammate_9',
|
'y_player_teammate_7', 'y_player_teammate_8', 'y_player_teammate_9',
|
||||||
'y_player_teammate_10', 'x_player_opponent_7', 'y_player_opponent_7',
|
'y_player_teammate_10', 'x_player_opponent_7', 'y_player_opponent_7',
|
||||||
'x_player_teammate_Goalkeeper', 'y_player_teammate_Goalkeeper'])
|
'x_player_teammate_Goalkeeper', 'y_player_teammate_Goalkeeper',
|
||||||
|
'shot_kick_off'])
|
||||||
|
|
||||||
|
|
||||||
shooter = konwertujDoListy(shooter)
|
shooter = konwertujDoListy(shooter)
|
||||||
@ -204,7 +183,7 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
|||||||
#Reszta Zawodnikow
|
#Reszta Zawodnikow
|
||||||
X_new.loc[len(X_new.index)] = [minute, position_name, shot_body_part_name,
|
X_new.loc[len(X_new.index)] = [minute, position_name, shot_body_part_name,
|
||||||
shot_technique_name,shot_type_name, shot_first_time,
|
shot_technique_name,shot_type_name, shot_first_time,
|
||||||
shot_one_on_one,shot_aerial_won,
|
shot_one_on_one,shot_aerial_won, shot_deflected,
|
||||||
shot_open_goal,shot_follows_dribble, shot_redirect,
|
shot_open_goal,shot_follows_dribble, shot_redirect,
|
||||||
shooter[0], shooter[1],number_of_players_opponents,
|
shooter[0], shooter[1],number_of_players_opponents,
|
||||||
number_of_players_teammates,angle, distance,
|
number_of_players_teammates,angle, distance,
|
||||||
@ -225,7 +204,8 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
|||||||
teamMatesList[0][1],teamMatesList[1][1], teamMatesList[2][1],
|
teamMatesList[0][1],teamMatesList[1][1], teamMatesList[2][1],
|
||||||
teamMatesList[4][1],teamMatesList[5][1], teamMatesList[6][1], teamMatesList[7][1],
|
teamMatesList[4][1],teamMatesList[5][1], teamMatesList[6][1], teamMatesList[7][1],
|
||||||
teamMatesList[8][1], teamMatesList[9][1],
|
teamMatesList[8][1], teamMatesList[9][1],
|
||||||
x_player_teammate_Goalkeeper, y_player_teammate_Goalkeeper]
|
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
|
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 = pd.get_dummies(X_new, columns=categorical_columns)
|
||||||
|
@ -31,15 +31,6 @@ def get_model():
|
|||||||
acionType = request.args.get('actionType')
|
acionType = request.args.get('actionType')
|
||||||
minute = request.args.get('gameMinute')
|
minute = request.args.get('gameMinute')
|
||||||
position_name = request.args.get('shooterPossition')
|
position_name = request.args.get('shooterPossition')
|
||||||
gameMinute = request.args.get('gameMinute')
|
|
||||||
|
|
||||||
shot_first_time = request.args.get('shot_first_time')
|
|
||||||
shot_one_on_one = request.args.get('shot_one_on_one')
|
|
||||||
shot_aerial_won = request.args.get('shot_aerial_won')
|
|
||||||
shot_open_goal = request.args.get('shot_open_goal')
|
|
||||||
shot_follows_dribble = request.args.get('shot_follows_dribble')
|
|
||||||
shot_redirect = request.args.get('shot_redirect')
|
|
||||||
|
|
||||||
|
|
||||||
shooter_x, shooter_y = shooter.split(',')
|
shooter_x, shooter_y = shooter.split(',')
|
||||||
|
|
||||||
@ -90,9 +81,6 @@ def get_model():
|
|||||||
atakujacy_lista = konwertujDoListy(atakujacy)
|
atakujacy_lista = konwertujDoListy(atakujacy)
|
||||||
atakujacy_macierz = zmienWMaciez(atakujacy_lista)
|
atakujacy_macierz = zmienWMaciez(atakujacy_lista)
|
||||||
|
|
||||||
if gameMinute == "":
|
|
||||||
gameMinute = 1.0 # to change
|
|
||||||
|
|
||||||
print("wspolrzedne obroncow: ", obroncy)
|
print("wspolrzedne obroncow: ", obroncy)
|
||||||
print("wspolrzedne atakujacych: ", atakujacy)
|
print("wspolrzedne atakujacych: ", atakujacy)
|
||||||
|
|
||||||
@ -124,15 +112,9 @@ def get_model():
|
|||||||
posortowani_atakujacy = sort_coordinates_by_distance(atakujacy_macierz, [shooter_x, shooter_y])
|
posortowani_atakujacy = sort_coordinates_by_distance(atakujacy_macierz, [shooter_x, shooter_y])
|
||||||
|
|
||||||
print("Posortowani obroncy: ", posortowani_obroncy)
|
print("Posortowani obroncy: ", posortowani_obroncy)
|
||||||
|
|
||||||
print("Posortowani atakujacy: ", posortowani_atakujacy)
|
print("Posortowani atakujacy: ", posortowani_atakujacy)
|
||||||
|
|
||||||
|
|
||||||
number_of_players_opponents = float(np.sum(~np.isnan(posortowani_obroncy).all(axis=1)))
|
|
||||||
number_of_players_teammates = float(np.sum(~np.isnan(posortowani_atakujacy).all(axis=1)))
|
|
||||||
|
|
||||||
print("Liczba obroncow:", number_of_players_opponents)
|
|
||||||
print("Liczba atakujacych:", number_of_players_teammates)
|
|
||||||
## add angle, match minutes and number of players
|
## add angle, match minutes and number of players
|
||||||
|
|
||||||
def loc2angle(x, y):
|
def loc2angle(x, y):
|
||||||
@ -159,55 +141,23 @@ def get_model():
|
|||||||
|
|
||||||
print("bramkarz:", goalkepper_x, goalkepper_y)
|
print("bramkarz:", goalkepper_x, goalkepper_y)
|
||||||
|
|
||||||
if shot_first_time == 'true':
|
|
||||||
shot_first_time = True
|
|
||||||
else:
|
|
||||||
shot_first_time = False
|
|
||||||
if shot_one_on_one == 'true':
|
|
||||||
shot_one_on_one = True
|
|
||||||
else:
|
|
||||||
shot_one_on_one = False
|
|
||||||
if shot_aerial_won == 'true':
|
|
||||||
shot_aerial_won = True
|
|
||||||
else:
|
|
||||||
shot_aerial_won = False
|
|
||||||
if shot_open_goal == 'true':
|
|
||||||
shot_open_goal = True
|
|
||||||
else:
|
|
||||||
shot_open_goal = False
|
|
||||||
if shot_follows_dribble == 'true':
|
|
||||||
shot_follows_dribble = True
|
|
||||||
else:
|
|
||||||
shot_follows_dribble = False
|
|
||||||
if shot_redirect == 'true':
|
|
||||||
shot_redirect = True
|
|
||||||
else:
|
|
||||||
shot_redirect = False
|
|
||||||
|
|
||||||
#### CHECKLIST
|
|
||||||
print('CHECKLISTA')
|
|
||||||
print('shot_first_time', shot_first_time)
|
|
||||||
print('shot_one_on_one', shot_one_on_one)
|
|
||||||
print('shot_aerial_won', shot_aerial_won)
|
|
||||||
print('shot_open_goal', shot_open_goal)
|
|
||||||
print('shot_follows_dribble', shot_follows_dribble)
|
|
||||||
print('shot_redirect', shot_redirect)
|
|
||||||
|
|
||||||
# MODEL XGBOOST
|
# MODEL XGBOOST
|
||||||
response = xgboost_predict_proba(minute=int(gameMinute), #minute=0,
|
response = xgboost_predict_proba(minute=1,
|
||||||
position_name=position_name,
|
position_name=position_name,
|
||||||
shot_body_part_name=body_part,
|
shot_body_part_name=body_part,
|
||||||
shot_technique_name=technique,
|
shot_technique_name=technique,
|
||||||
shot_type_name=acionType,
|
shot_type_name=acionType,
|
||||||
shot_first_time=shot_first_time,
|
shot_first_time=False,
|
||||||
shot_one_on_one=shot_one_on_one,
|
shot_one_on_one=False,
|
||||||
shot_aerial_won=shot_aerial_won,
|
shot_aerial_won=False,
|
||||||
shot_open_goal=shot_open_goal,
|
shot_deflected=False,
|
||||||
shot_follows_dribble=shot_follows_dribble,
|
shot_open_goal=False,
|
||||||
shot_redirect=shot_redirect,
|
shot_follows_dribble=False,
|
||||||
|
shot_redirect=False,
|
||||||
|
shot_kick_off=False,
|
||||||
x1=shooter_x, y1=shooter_y,
|
x1=shooter_x, y1=shooter_y,
|
||||||
number_of_players_opponents=number_of_players_opponents,
|
number_of_players_opponents=0,
|
||||||
number_of_players_teammates=number_of_players_teammates,
|
number_of_players_teammates=0,
|
||||||
angle=angle, distance=dist,
|
angle=angle, distance=dist,
|
||||||
x_player_opponent_Goalkeeper=goalkepper_x, y_player_opponent_Goalkeeper=goalkepper_y,
|
x_player_opponent_Goalkeeper=goalkepper_x, y_player_opponent_Goalkeeper=goalkepper_y,
|
||||||
x_player_opponent_1=posortowani_obroncy[0][0], y_player_opponent_1=posortowani_obroncy[0][1],
|
x_player_opponent_1=posortowani_obroncy[0][0], y_player_opponent_1=posortowani_obroncy[0][1],
|
||||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -277,7 +277,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.additional-parameters {
|
.additional-parameters {
|
||||||
position: relative; /* Or absolute, depending on layout */
|
position: fixed; /* Or absolute, depending on layout */
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 30%; /* Adjusted to a higher position */
|
top: 30%; /* Adjusted to a higher position */
|
||||||
width: 250px; /* Increased width */
|
width: 250px; /* Increased width */
|
||||||
|
BIN
data/.DS_Store
vendored
BIN
data/.DS_Store
vendored
Binary file not shown.
76686
data/final_data.csv
76686
data/final_data.csv
File diff suppressed because it is too large
Load Diff
82822
data/final_data_new.csv
82822
data/final_data_new.csv
File diff suppressed because it is too large
Load Diff
38343
data/final_data_old.csv
38343
data/final_data_old.csv
File diff suppressed because it is too large
Load Diff
BIN
notebooks/.DS_Store
vendored
BIN
notebooks/.DS_Store
vendored
Binary file not shown.
38343
notebooks/final_data.csv
38343
notebooks/final_data.csv
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user