Compare commits
No commits in common. "master" and "4cbed48308a79b09027fa7022fe7f84d00633ae1" have entirely different histories.
master
...
4cbed48308
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:
|
||||||
|
|
||||||
|
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`
|
||||||
|
|
||||||
2. **Uruchomienie aplikacji webowej** Po wykonaiu kroku 1 można wejść na właściwą stronę [aplikacji](https://statgoals.onrender.com/).
|
|
||||||
|
|
||||||
## 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.
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 87 KiB |
@ -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
|
||||||
|
|
||||||
@ -82,10 +30,10 @@ const handleRedirectChange = (event) => {
|
|||||||
var stricers = new Array;
|
var stricers = new Array;
|
||||||
var defenders = new Array;
|
var defenders = new Array;
|
||||||
|
|
||||||
const [bodyPart,setBodyPart] = useState('Right Foot');
|
const [bodyPart,setBodyPart] = useState('prawa');
|
||||||
const [technique,setTechnique] = useState('Normal');
|
const [technique,setTechnique] = useState('zwykly');
|
||||||
const [actionType,setActionType] = useState('Open Play');
|
const [actionType,setActionType] = useState('pozycyjny');
|
||||||
const [shooterPossition,setPossition] = useState('Center Forward');
|
const [shooterPossition,setPossition] = useState('napastnik');
|
||||||
|
|
||||||
//zamiana procentowych pozycji na kartezyjskie
|
//zamiana procentowych pozycji na kartezyjskie
|
||||||
function konwerturX(x){
|
function konwerturX(x){
|
||||||
@ -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"
|
||||||
@ -210,18 +148,18 @@ const handleRedirectChange = (event) => {
|
|||||||
|
|
||||||
// div z nazwa gracza
|
// div z nazwa gracza
|
||||||
var tekst = document.createElement('div')
|
var tekst = document.createElement('div')
|
||||||
tekst.style.fontSize = "12px";
|
tekst.style.fontSize = "10px";
|
||||||
tekst.innerHTML = pName;
|
tekst.innerHTML = pName;
|
||||||
|
|
||||||
// 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 = "10px"
|
||||||
posytion.innerHTML = konwerturX(ball.style.left) + " m, " + 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)])
|
||||||
//div z przyciskiem usuwającym
|
//div z przyciskiem usuwającym
|
||||||
var btnDelete = document.createElement('button')
|
var btnDelete = document.createElement('button')
|
||||||
btnDelete.innerHTML = 'Usuń'
|
btnDelete.innerHTML = 'Usun'
|
||||||
btnDelete.style.fontSize = "12px"
|
btnDelete.style.fontSize = "10px"
|
||||||
btnDelete.style = 'background-color: #FFB266;color:#000000'
|
btnDelete.style = 'background-color: #FFB266;color:#000000'
|
||||||
btnDelete.addEventListener("click",function(){deletePlayer(ball,player,possition)},false)
|
btnDelete.addEventListener("click",function(){deletePlayer(ball,player,possition)},false)
|
||||||
//dodanie elementów do kafelka
|
//dodanie elementów do kafelka
|
||||||
@ -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 + "%"
|
||||||
@ -282,28 +220,25 @@ const handleRedirectChange = (event) => {
|
|||||||
//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();
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // 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);
|
|
||||||
// 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 => {
|
||||||
@ -311,8 +246,7 @@ const handleRedirectChange = (event) => {
|
|||||||
console.log(data);
|
console.log(data);
|
||||||
// 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 = "Współczynnik xG: " + eX;
|
||||||
//updateXGMeter(eX);
|
|
||||||
}
|
}
|
||||||
).catch(error => {
|
).catch(error => {
|
||||||
console.error('Błąd:', error);
|
console.error('Błąd:', error);
|
||||||
@ -320,11 +254,12 @@ 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*/
|
||||||
function boiskoListener(ev){
|
function boiskoListener(ev){
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
@ -341,32 +276,38 @@ const handleRedirectChange = (event) => {
|
|||||||
ball.style.top = y + "%"
|
ball.style.top = y + "%"
|
||||||
|
|
||||||
//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,18 +336,16 @@ 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 = "prawa">Noga Prawa</option>
|
||||||
<option value = "Left Foot">Noga Lewa</option>
|
<option value = "lewa">Noga Lewa</option>
|
||||||
<option value = "Head">Głowa</option>
|
<option value = "glowa">Głowa</option>
|
||||||
<option value = "Other" >Inna</option>
|
<option value = "inna" >Inna</option>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -414,62 +353,37 @@ 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="zwykly"> Zwykły </option>
|
||||||
<option value = "Volley"> Wolej </option>
|
<option value = "voley"> Wolej </option>
|
||||||
<option value = "Half Volley"> Półwolej </option>
|
<option value = "pol-voley"> Półwolej </option>
|
||||||
<option value = "Lob"> Lob </option>
|
<option value = "lob"> Lob </option>
|
||||||
<option value = "Diving Header"> Szczupak </option>
|
<option value = "szczupak"> Szczupak </option>
|
||||||
<option value = "Overhead Kick"> Kopnięcie z góry </option>
|
<option value = "z_gory"> Kopnięcie z góry </option>
|
||||||
<option value = "Backheel"> Piętka </option>
|
<option value = "pietka"> Piętka </option>
|
||||||
</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 = "pozycyjny"> Atak Pozycyjny </option>
|
||||||
<option value = "Free Kick"> Rzut Wolny </option>
|
<option value = "wolny"> Rzut Wolny </option>
|
||||||
<option value = "Penalty"> Rzut Karny </option>
|
<option value = "karny"> Rzut Karny </option>
|
||||||
<option value= "Corner"> Rzut Rozny </option>
|
<option value= "rozny"> Rzut Rozny </option>
|
||||||
|
<option value="rozpoczecie"> Rozpoczęcie </option>
|
||||||
</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= "napastnik" > Napastnik </option>
|
||||||
<option value="Left Center Forward">Lewy Środkowy Napastnik</option>
|
<option value = "bramkarz"> Bramkarz </option>
|
||||||
<option value="Secondary Striker">Drugi Napastnik</option>
|
<option value = "obronca"> Obrońca </option>
|
||||||
<option value="Center Forward">Środkowy Napastnik</option>
|
<option value = "pomocnik"> Pomocnik </option>
|
||||||
<option value="Center Midfield">Środkowy Pomocnik</option>
|
|
||||||
<option value="Left Center Midfield">Lewy Środkowy Pomocnik</option>
|
|
||||||
<option value="Right Center Midfield">Prawy Środkowy Pomocnik</option>
|
|
||||||
<option value="Left Midfield">Lewy Pomocnik</option>
|
|
||||||
<option value="Center Attacking Midfield">Środkowy Ofensywny Pomocnik</option>
|
|
||||||
<option value="Left Defensive Midfield">Lewy Defensywny Pomocnik</option>
|
|
||||||
<option value="Left Attacking Midfield">Lewy Ofensywny Pomocnik</option>
|
|
||||||
<option value="Right Attacking Midfield">Prawy Ofensywny Pomocnik</option>
|
|
||||||
<option value="Right Defensive Midfield">Prawy Defensywny Pomocnik</option>
|
|
||||||
<option value="Center Defensive Midfield">Środkowy Defensywny Pomocnik</option>
|
|
||||||
<option value="Right Midfield">Prawy Pomocnik</option>
|
|
||||||
<option value="Left Wing Back">Lewy Pomocnik Skrzydłowy</option>
|
|
||||||
<option value="Left Wing">Lewe Skrzydło</option>
|
|
||||||
<option value="Right Wing">Prawe Skrzydło</option>
|
|
||||||
<option value="Right Wing Back">Prawy Pomocnik Skrzydłowy</option>
|
|
||||||
<option value="Center Back">Środkowy Obrońca</option>
|
|
||||||
<option value="Left Center Back">Lewy Środkowy Obrońca</option>
|
|
||||||
<option value="Right Center Back">Prawy Środkowy Obrońca</option>
|
|
||||||
<option value="Right Back">Prawy Obrońca</option>
|
|
||||||
<option value="Left Back">Lewy Obrońca</option>
|
|
||||||
<option value="Goalkeeper">Bramkarz</option>
|
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -495,40 +409,25 @@ 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">
|
|
||||||
<h3>Parametry strzału</h3>
|
{/* <div className="ChoosingPlayer">
|
||||||
<label>
|
<button className="cho-one_on_one" id = "bbt8">Sam na sam</button>
|
||||||
<input type="checkbox" id="firstShot" onChange={handleFirstShotChange} />
|
|
||||||
Pierwszy w meczu
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="oneOnOne" onChange={handleOneOnOneChange} />
|
|
||||||
Akcja sam na sam
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="afterAirDuel" onChange={handleAfterAirDuelChange} />
|
|
||||||
Po pojedynku powietrznym
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="openGoal" onChange={handleOpenGoalChange} />
|
|
||||||
Na pustą bramkę
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="afterDribbling" onChange={handleAfterDribblingChange} />
|
|
||||||
Poprzedzony dryblingiem
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="redirect" onChange={handleRedirectChange} />
|
|
||||||
Rykoszet
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="ChoosingPlayer">
|
||||||
|
<button className="cho-first_time" id = "bbt12">Pierwszy w meczu</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="ChoosingPlayer">
|
||||||
|
<button className="cho-aerial_won" id = "bbt13">Pojedynek powietrzny</button>
|
||||||
</div>
|
</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 +437,11 @@ 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>
|
||||||
|
<b id = "ex" className="Ex">
|
||||||
|
|
||||||
|
</b>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -3,7 +3,6 @@ import React from 'react'
|
|||||||
const Loader = () => {
|
const Loader = () => {
|
||||||
return (
|
return (
|
||||||
<div>Loader</div>
|
<div>Loader</div>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,74 +2,21 @@ from joblib import load
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
import math
|
import math
|
||||||
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):
|
||||||
|
|
||||||
# distance_to_goalM = sqrt(( (position_x**2) + (position_y**2)))
|
# distance_to_goalM = sqrt(( (position_x**2) + (position_y**2)))
|
||||||
|
|
||||||
model = load('regresja_logistyczna.joblib')
|
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 = 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]
|
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]
|
||||||
return model.predict_proba(X_new)[0][1].round(2)
|
return model.predict_proba(X_new)[0][1].round(2)
|
||||||
|
|
||||||
#xgBoost
|
#xgBoost
|
||||||
def xgboost_predict_proba(minute=0, position_name='Center Forward', shot_body_part_name='Right Foot',
|
def xgboost_predict_proba(minute, position_name, shot_body_part_name, shot_technique_name,
|
||||||
shot_technique_name='Normal', shot_type_name='Open Play', shot_first_time=False,
|
|
||||||
shot_one_on_one=False, shot_aerial_won=False,
|
|
||||||
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,
|
|
||||||
angle=0.0, distance=0.0, x_player_opponent_Goalkeeper=np.nan,
|
|
||||||
x_player_opponent_8=np.nan, x_player_opponent_1=np.nan, x_player_opponent_2=np.nan,
|
|
||||||
x_player_opponent_3=np.nan, x_player_teammate_1=np.nan, x_player_opponent_4=np.nan,
|
|
||||||
x_player_opponent_5=np.nan, x_player_opponent_6=np.nan, x_player_teammate_2=np.nan,
|
|
||||||
x_player_opponent_9=np.nan, x_player_opponent_10=np.nan, x_player_opponent_11=np.nan,
|
|
||||||
x_player_teammate_3=np.nan, x_player_teammate_4=np.nan, x_player_teammate_5=np.nan,
|
|
||||||
x_player_teammate_6=np.nan, x_player_teammate_7=np.nan, x_player_teammate_8=np.nan,
|
|
||||||
y_player_opponent_Goalkeeper=np.nan, y_player_opponent_8=np.nan,
|
|
||||||
x_player_teammate_9=np.nan, x_player_teammate_10=np.nan,
|
|
||||||
y_player_opponent_1=np.nan, y_player_opponent_2=np.nan, y_player_opponent_3=np.nan,
|
|
||||||
y_player_teammate_1=np.nan, y_player_opponent_4=np.nan, y_player_opponent_5=np.nan,
|
|
||||||
y_player_opponent_6=np.nan, y_player_teammate_2=np.nan, y_player_opponent_9=np.nan,
|
|
||||||
y_player_opponent_10=np.nan, y_player_opponent_11=np.nan, y_player_teammate_3=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_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):
|
|
||||||
|
|
||||||
model = xgboost.XGBClassifier()
|
|
||||||
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',
|
|
||||||
'shot_type_name', 'shot_first_time', 'shot_one_on_one',
|
|
||||||
'shot_aerial_won', '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_8', 'x_player_opponent_1', 'x_player_opponent_2',
|
|
||||||
'x_player_opponent_3', 'x_player_teammate_1', 'x_player_opponent_4',
|
|
||||||
'x_player_opponent_5', 'x_player_opponent_6', 'x_player_teammate_2',
|
|
||||||
'x_player_opponent_9', 'x_player_opponent_10', 'x_player_opponent_11',
|
|
||||||
'x_player_teammate_3', 'x_player_teammate_4', 'x_player_teammate_5',
|
|
||||||
'x_player_teammate_6', 'x_player_teammate_7', 'x_player_teammate_8',
|
|
||||||
'x_player_teammate_9', 'x_player_teammate_10',
|
|
||||||
'y_player_opponent_Goalkeeper', 'y_player_opponent_8',
|
|
||||||
'y_player_opponent_1', 'y_player_opponent_2', 'y_player_opponent_3',
|
|
||||||
'y_player_teammate_1', 'y_player_opponent_4', 'y_player_opponent_5',
|
|
||||||
'y_player_opponent_6', 'y_player_teammate_2', 'y_player_opponent_9',
|
|
||||||
'y_player_opponent_10', 'y_player_opponent_11', 'y_player_teammate_3',
|
|
||||||
'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_10', 'x_player_opponent_7', 'y_player_opponent_7',
|
|
||||||
'x_player_teammate_Goalkeeper', 'y_player_teammate_Goalkeeper'])
|
|
||||||
|
|
||||||
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,71 +35,72 @@ 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',
|
model = load('xgboost.joblib')
|
||||||
'shot_technique_name',
|
X_new = pd.DataFrame(columns=['minute', 'position_name', 'shot_body_part_name', 'shot_technique_name',
|
||||||
'shot_type_name',
|
'shot_type_name', 'shot_first_time', 'shot_one_on_one',
|
||||||
'shot_body_part_name']] = enc.transform(X_new[['position_name', 'shot_technique_name', 'shot_type_name', 'shot_body_part_name']], )
|
'shot_aerial_won', 'shot_deflected', '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_8', 'x_player_opponent_1', 'x_player_opponent_2',
|
||||||
|
'x_player_opponent_3', 'x_player_teammate_1', 'x_player_opponent_4',
|
||||||
|
'x_player_opponent_5', 'x_player_opponent_6', 'x_player_teammate_2',
|
||||||
|
'x_player_opponent_9', 'x_player_opponent_10', 'x_player_opponent_11',
|
||||||
|
'x_player_teammate_3', 'x_player_teammate_4', 'x_player_teammate_5',
|
||||||
|
'x_player_teammate_6', 'x_player_teammate_7', 'x_player_teammate_8',
|
||||||
|
'x_player_teammate_9', 'x_player_teammate_10',
|
||||||
|
'y_player_opponent_Goalkeeper', 'y_player_opponent_8',
|
||||||
|
'y_player_opponent_1', 'y_player_opponent_2', 'y_player_opponent_3',
|
||||||
|
'y_player_teammate_1', 'y_player_opponent_4', 'y_player_opponent_5',
|
||||||
|
'y_player_opponent_6', 'y_player_teammate_2', 'y_player_opponent_9',
|
||||||
|
'y_player_opponent_10', 'y_player_opponent_11', 'y_player_teammate_3',
|
||||||
|
'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_10', 'x_player_opponent_7', 'y_player_opponent_7',
|
||||||
|
'x_player_teammate_Goalkeeper', 'y_player_teammate_Goalkeeper',
|
||||||
|
'shot_kick_off'])
|
||||||
|
|
||||||
X_new[['minute',
|
X_new.loc[len(X_new.index)] = [minute, position_name, shot_body_part_name, shot_technique_name,
|
||||||
'position_name',
|
shot_type_name, shot_first_time, shot_one_on_one,
|
||||||
'shot_technique_name',
|
shot_aerial_won, shot_deflected, shot_open_goal,
|
||||||
'shot_type_name',
|
shot_follows_dribble, shot_redirect, x1, y1,
|
||||||
'number_of_players_opponents',
|
number_of_players_opponents, number_of_players_teammates,
|
||||||
'number_of_players_teammates',
|
angle, distance, x_player_opponent_Goalkeeper,
|
||||||
'shot_body_part_name']] = X_new[['minute',
|
x_player_opponent_8, x_player_opponent_1, x_player_opponent_2,
|
||||||
'position_name',
|
x_player_opponent_3, x_player_teammate_1, x_player_opponent_4,
|
||||||
'shot_technique_name',
|
x_player_opponent_5, x_player_opponent_6, x_player_teammate_2,
|
||||||
'shot_type_name',
|
x_player_opponent_9, x_player_opponent_10, x_player_opponent_11,
|
||||||
'number_of_players_opponents',
|
x_player_teammate_3, x_player_teammate_4, x_player_teammate_5,
|
||||||
'number_of_players_teammates',
|
x_player_teammate_6, x_player_teammate_7, x_player_teammate_8,
|
||||||
'shot_body_part_name']].astype(int)
|
x_player_teammate_9, x_player_teammate_10,
|
||||||
|
y_player_opponent_Goalkeeper, y_player_opponent_8,
|
||||||
# X_new[['minute',
|
y_player_opponent_1, y_player_opponent_2, y_player_opponent_3,
|
||||||
# 'position_name',
|
y_player_teammate_1, y_player_opponent_4, y_player_opponent_5,
|
||||||
# 'shot_technique_name',
|
y_player_opponent_6, y_player_teammate_2, y_player_opponent_9,
|
||||||
# 'shot_type_name',
|
y_player_opponent_10, y_player_opponent_11, y_player_teammate_3,
|
||||||
# 'number_of_players_opponents',
|
y_player_teammate_4, y_player_teammate_5, y_player_teammate_6,
|
||||||
# 'number_of_players_teammates',
|
y_player_teammate_7, y_player_teammate_8, y_player_teammate_9,
|
||||||
# 'shot_body_part_name']] = X_new[['minute',
|
y_player_teammate_10, x_player_opponent_7, y_player_opponent_7,
|
||||||
# 'position_name',
|
x_player_teammate_Goalkeeper, y_player_teammate_Goalkeeper,
|
||||||
# 'shot_technique_name',
|
shot_kick_off]
|
||||||
# 'shot_type_name',
|
return model.predict_proba(X_new)[0][1].round(2)
|
||||||
# 'number_of_players_opponents',
|
|
||||||
# 'number_of_players_teammates',
|
|
||||||
# 'shot_body_part_name']].astype('category')
|
|
||||||
|
|
||||||
X_new[['shot_first_time',
|
|
||||||
'shot_one_on_one',
|
|
||||||
'shot_aerial_won',
|
|
||||||
'shot_open_goal',
|
|
||||||
'shot_follows_dribble',
|
|
||||||
'shot_redirect']] = X_new[['shot_first_time',
|
|
||||||
'shot_one_on_one',
|
|
||||||
'shot_aerial_won',
|
|
||||||
'shot_open_goal',
|
|
||||||
'shot_follows_dribble',
|
|
||||||
'shot_redirect']].astype(int)
|
|
||||||
print(X_new)
|
|
||||||
print(X_new.dtypes)
|
|
||||||
|
|
||||||
|
|
||||||
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',
|
||||||
'x_player_opponent_Goalkeeper', 'x_player_opponent_8',
|
'x_player_opponent_Goalkeeper',
|
||||||
'x_player_opponent_1', 'x_player_opponent_2','x_player_opponent_3',
|
'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_opponent_4','x_player_opponent_5', 'x_player_opponent_6',
|
||||||
'x_player_teammate_2','x_player_opponent_9', 'x_player_opponent_10',
|
'x_player_teammate_2','x_player_opponent_9', 'x_player_opponent_10',
|
||||||
@ -168,7 +116,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)
|
||||||
@ -188,10 +137,8 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
|||||||
teamMatesList = zmienWMaciez(teamMatesList)
|
teamMatesList = zmienWMaciez(teamMatesList)
|
||||||
opponentsList = zmienWMaciez(opponentsList)
|
opponentsList = zmienWMaciez(opponentsList)
|
||||||
|
|
||||||
|
number_of_players_opponents = len(teamMatesList)
|
||||||
# DO ROZBUDOWY
|
number_of_players_teammates = len(opponentsList)
|
||||||
number_of_players_opponents = 3
|
|
||||||
number_of_players_teammates = 3
|
|
||||||
# Bramkarz
|
# Bramkarz
|
||||||
x_player_opponent_Goalkeeper = goalkeeper[0]
|
x_player_opponent_Goalkeeper = goalkeeper[0]
|
||||||
y_player_opponent_Goalkeeper = goalkeeper[1]
|
y_player_opponent_Goalkeeper = goalkeeper[1]
|
||||||
@ -199,16 +146,19 @@ def xgboost_predict_proba_v2(shooter,goalkeeper,teamMatesList,opponentsList, min
|
|||||||
shot_one_on_one = True if number_of_players_opponents == 1 else False
|
shot_one_on_one = True if number_of_players_opponents == 1 else False
|
||||||
# TeamMate goalkeppe
|
# TeamMate goalkeppe
|
||||||
|
|
||||||
x_player_teammate_Goalkeeper = np.nan
|
x_player_teammate_Goalkeeper = None
|
||||||
y_player_teammate_Goalkeeper = np.nan
|
y_player_teammate_Goalkeeper = None
|
||||||
#Reszta Zawodnikow
|
#Reszta Zawodnikow
|
||||||
|
|
||||||
|
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
|
||||||
|
print(X_new.head)
|
||||||
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,
|
||||||
x_player_opponent_Goalkeeper, opponentsList[8][0],
|
x_player_opponent_Goalkeeper,
|
||||||
opponentsList[0][0], opponentsList[1][0], opponentsList[2][0],
|
opponentsList[0][0], opponentsList[1][0], opponentsList[2][0],
|
||||||
opponentsList[3][0], opponentsList[4][0], opponentsList[5][0],
|
opponentsList[3][0], opponentsList[4][0], opponentsList[5][0],
|
||||||
opponentsList[6][0], opponentsList[7][0], teamMatesList[8][0],
|
opponentsList[6][0], opponentsList[7][0], teamMatesList[8][0],
|
||||||
@ -225,17 +175,13 @@ 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
|
|
||||||
# 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)
|
return model.predict_proba(X_new)[0][1].round(2)
|
||||||
|
|
||||||
|
|
||||||
# Pomocnicze Funkcje
|
# Pomocnicze Funkcje
|
||||||
# trzeba uzupelnic
|
|
||||||
def sortNearestToShooter(playerList, shooter):
|
def sortNearestToShooter(playerList, shooter):
|
||||||
|
|
||||||
return playerList
|
return playerList
|
||||||
@ -252,14 +198,14 @@ def loc2angle(x, y):
|
|||||||
rads = math.pi + rads if rads < 0 else rads
|
rads = math.pi + rads if rads < 0 else rads
|
||||||
deg = math.degrees(rads)
|
deg = math.degrees(rads)
|
||||||
return deg
|
return deg
|
||||||
# zamiana stringa odzielonego ',' na liste
|
|
||||||
def konwertujDoListy(listaString):
|
def konwertujDoListy(listaString):
|
||||||
listaString = listaString.split(",")
|
listaString = listaString.split(",")
|
||||||
listaFloat = []
|
listaFloat = []
|
||||||
for elem in listaString:
|
for elem in listaString:
|
||||||
listaFloat.append(float(elem))
|
listaFloat.append(float(elem))
|
||||||
return listaFloat
|
return listaFloat
|
||||||
#Zamiana listy w formie [1x,1y,2x,2y,3x,3y...] do postaci maciezy [xi, yi]
|
|
||||||
def zmienWMaciez(lista):
|
def zmienWMaciez(lista):
|
||||||
maciez = []
|
maciez = []
|
||||||
for i in range(0,len(lista),2):
|
for i in range(0,len(lista),2):
|
||||||
@ -267,5 +213,5 @@ def zmienWMaciez(lista):
|
|||||||
maciez.append(player)
|
maciez.append(player)
|
||||||
if(len(maciez) < 10):
|
if(len(maciez) < 10):
|
||||||
for i in range(len(maciez),11,1):
|
for i in range(len(maciez),11,1):
|
||||||
maciez.append([np.nan,np.nan])
|
maciez.append([None,None])
|
||||||
return maciez
|
return maciez
|
@ -1,8 +1,6 @@
|
|||||||
from flask import Flask, request, jsonify
|
from flask import Flask, request, jsonify
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from modele.modele import LogisticRegression_predict_proba, xgboost_predict_proba, xgboost_predict_proba_v2
|
from modele.modele import LogisticRegression_predict_proba, xgboost_predict_proba, xgboost_predict_proba_v2
|
||||||
import numpy as np
|
|
||||||
import math
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@ -26,218 +24,37 @@ def get_model():
|
|||||||
|
|
||||||
# Elementy z list: czesc ciała,rodzaj uderzenia,pozycja strzelca oraz typ akcji
|
# Elementy z list: czesc ciała,rodzaj uderzenia,pozycja strzelca oraz typ akcji
|
||||||
|
|
||||||
|
position_name = request.args.get('shooter')
|
||||||
body_part = request.args.get('bodyPart')
|
body_part = request.args.get('bodyPart')
|
||||||
technique = request.args.get('technique')
|
technique = request.args.get('technique')
|
||||||
acionType = request.args.get('actionType')
|
acionType = request.args.get('actionType')
|
||||||
minute = request.args.get('gameMinute')
|
|
||||||
position_name = request.args.get('shooterPossition')
|
|
||||||
gameMinute = request.args.get('gameMinute')
|
|
||||||
|
|
||||||
shot_first_time = request.args.get('shot_first_time')
|
print("pozycja strzelca: " + position_name)
|
||||||
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 = float(shooter_x)
|
|
||||||
shooter_y = float(shooter_y)
|
|
||||||
|
|
||||||
print("minuta: ", minute)
|
|
||||||
print("pozycja x1 strzelca: ", shooter_x)
|
|
||||||
print("pozycja y1 strzelca: ", shooter_y)
|
|
||||||
print("czesc ciala: " + body_part)
|
print("czesc ciala: " + body_part)
|
||||||
print("technika: " + technique)
|
print("technika: " + technique)
|
||||||
print("typ akcji: " + acionType)
|
print("typ akcji: " + acionType)
|
||||||
|
|
||||||
# lista atakujacy oraz obroncy
|
# lista wspolzawodnikow oraz przeciwnikow
|
||||||
|
|
||||||
def konwertujDoListy(listaString):
|
teamMatesList = request.args.get('defenders')
|
||||||
listaString = listaString.split(",")
|
opponentsList = request.args.get('strickers')
|
||||||
listaFloat = []
|
|
||||||
for elem in listaString:
|
|
||||||
listaFloat.append(float(elem))
|
|
||||||
return listaFloat
|
|
||||||
|
|
||||||
def zmienWMaciez(lista):
|
print("wspolrzedne obroncow: " + teamMatesList)
|
||||||
maciez = []
|
print("wspolrzedne przeciwnikow: " + opponentsList)
|
||||||
for i in range(0,len(lista),2):
|
|
||||||
player = [float(lista[i]),float(lista[i+1])]
|
|
||||||
maciez.append(player)
|
|
||||||
if(len(maciez) < 10):
|
|
||||||
for i in range(len(maciez),11,1):
|
|
||||||
maciez.append([np.nan,np.nan])
|
|
||||||
return maciez
|
|
||||||
|
|
||||||
|
|
||||||
obroncy = request.args.get('defenders')
|
# Bramkarz
|
||||||
atakujacy = request.args.get('strickers')
|
goalkepper = "2,2"
|
||||||
|
#goalkepper = request.args.get('goalkeeper')
|
||||||
|
|
||||||
print("wspolrzedne obroncow: ", obroncy)
|
print("bramkarz: " + str(goalkepper) )
|
||||||
|
|
||||||
if obroncy == "":
|
response = xgboost_predict_proba_v2(shooter = shooter,
|
||||||
obroncy_macierz = [[np.nan, np.nan]]
|
opponentsList = opponentsList, teamMatesList = teamMatesList ,minute = 20, position_name = position_name, shot_body_part_name = body_part, shot_technique_name = technique,
|
||||||
else:
|
shot_type_name = acionType, shot_first_time = False,
|
||||||
obroncy_lista = konwertujDoListy(obroncy)
|
shot_aerial_won = False, shot_deflected = False, shot_open_goal = False,
|
||||||
obroncy_macierz = zmienWMaciez(obroncy_lista)
|
shot_follows_dribble = False, shot_redirect = False, shot_kick_off = False, goalkeeper= goalkepper
|
||||||
|
)
|
||||||
if atakujacy == "":
|
|
||||||
atakujacy_macierz = [[np.nan, np.nan]]
|
|
||||||
else:
|
|
||||||
atakujacy_lista = konwertujDoListy(atakujacy)
|
|
||||||
atakujacy_macierz = zmienWMaciez(atakujacy_lista)
|
|
||||||
|
|
||||||
if gameMinute == "":
|
|
||||||
gameMinute = 1.0 # to change
|
|
||||||
|
|
||||||
print("wspolrzedne obroncow: ", obroncy)
|
|
||||||
print("wspolrzedne atakujacych: ", atakujacy)
|
|
||||||
|
|
||||||
def euclidean_distance(point1, point2):
|
|
||||||
"""Calculate the Euclidean distance between two points."""
|
|
||||||
return math.sqrt((point1[0] - point2[0])**2 + (point1[1] - point2[1])**2)
|
|
||||||
|
|
||||||
def sort_coordinates_by_distance(coordinates, reference_point):
|
|
||||||
"""Sort a list of coordinates based on Euclidean distance from a reference point.
|
|
||||||
Coordinates with NaN values are placed at the end of the list.
|
|
||||||
"""
|
|
||||||
def distance_or_inf(coord):
|
|
||||||
"""Helper function to handle coordinates with NaN values."""
|
|
||||||
if hasattr(coord, '__iter__') and len(coord) >= 2:
|
|
||||||
if np.isnan(coord[0]) or np.isnan(coord[1]):
|
|
||||||
return float('inf') # Set distance to infinity for NaN coordinates
|
|
||||||
return euclidean_distance(coord, reference_point)
|
|
||||||
return float('inf') # Set distance to infinity for non-iterable coordinates
|
|
||||||
|
|
||||||
sorted_coordinates = sorted(coordinates, key=distance_or_inf)
|
|
||||||
|
|
||||||
if(len(sorted_coordinates) < 10):
|
|
||||||
for i in range(len(sorted_coordinates),11,1):
|
|
||||||
sorted_coordinates.append([np.nan,np.nan])
|
|
||||||
return sorted_coordinates
|
|
||||||
|
|
||||||
# POSORTOWANI OBRONCY I ATAKUJACY
|
|
||||||
posortowani_obroncy = sort_coordinates_by_distance(obroncy_macierz, [shooter_x, shooter_y])
|
|
||||||
posortowani_atakujacy = sort_coordinates_by_distance(atakujacy_macierz, [shooter_x, shooter_y])
|
|
||||||
|
|
||||||
print("Posortowani obroncy: ", posortowani_obroncy)
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
def loc2angle(x, y):
|
|
||||||
rads = math.atan(7.32 * x / (x**2 + (y - 34)**2 - (7.32/2)**2))
|
|
||||||
rads = math.pi + rads if rads < 0 else rads
|
|
||||||
deg = math.degrees(rads)
|
|
||||||
return deg
|
|
||||||
|
|
||||||
def loc2distance(x, y):
|
|
||||||
return math.sqrt(x**2 + (y - 34)**2)
|
|
||||||
|
|
||||||
angle = loc2angle(x = shooter_x, y = shooter_y)
|
|
||||||
dist = loc2distance(x = shooter_x, y = shooter_y)
|
|
||||||
|
|
||||||
# BRAMKARZ
|
|
||||||
goalkepper = request.args.get('goalkeeper')
|
|
||||||
|
|
||||||
if goalkepper == "null":
|
|
||||||
goalkepper_x, goalkepper_y = np.nan, np.nan
|
|
||||||
else:
|
|
||||||
goalkepper_x, goalkepper_y = goalkepper.split(',')
|
|
||||||
goalkepper_x = float(goalkepper_x)
|
|
||||||
goalkepper_y = float(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
|
|
||||||
response = xgboost_predict_proba(minute=int(gameMinute), #minute=0,
|
|
||||||
position_name=position_name,
|
|
||||||
shot_body_part_name=body_part,
|
|
||||||
shot_technique_name=technique,
|
|
||||||
shot_type_name=acionType,
|
|
||||||
shot_first_time=shot_first_time,
|
|
||||||
shot_one_on_one=shot_one_on_one,
|
|
||||||
shot_aerial_won=shot_aerial_won,
|
|
||||||
shot_open_goal=shot_open_goal,
|
|
||||||
shot_follows_dribble=shot_follows_dribble,
|
|
||||||
shot_redirect=shot_redirect,
|
|
||||||
x1=shooter_x, y1=shooter_y,
|
|
||||||
number_of_players_opponents=number_of_players_opponents,
|
|
||||||
number_of_players_teammates=number_of_players_teammates,
|
|
||||||
angle=angle, distance=dist,
|
|
||||||
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_2=posortowani_obroncy[1][0], y_player_opponent_2=posortowani_obroncy[1][1],
|
|
||||||
x_player_opponent_3=posortowani_obroncy[2][0], y_player_opponent_3=posortowani_obroncy[2][1],
|
|
||||||
x_player_opponent_4=posortowani_obroncy[3][0], y_player_opponent_4=posortowani_obroncy[3][1],
|
|
||||||
x_player_opponent_5=posortowani_obroncy[4][0], y_player_opponent_5=posortowani_obroncy[4][1],
|
|
||||||
x_player_opponent_6=posortowani_obroncy[5][0], y_player_opponent_6=posortowani_obroncy[5][1],
|
|
||||||
x_player_opponent_7=posortowani_obroncy[6][0], y_player_opponent_7=posortowani_obroncy[6][1],
|
|
||||||
x_player_opponent_8=posortowani_obroncy[7][0], y_player_opponent_8=posortowani_obroncy[7][1],
|
|
||||||
x_player_opponent_9=posortowani_obroncy[8][0], y_player_opponent_9=posortowani_obroncy[8][1],
|
|
||||||
x_player_opponent_10=posortowani_obroncy[9][0], y_player_opponent_10=posortowani_obroncy[9][1],
|
|
||||||
x_player_teammate_Goalkeeper=np.nan, y_player_teammate_Goalkeeper=np.nan,
|
|
||||||
x_player_teammate_1=posortowani_atakujacy[0][0], y_player_teammate_1=posortowani_atakujacy[0][1],
|
|
||||||
x_player_teammate_2=posortowani_atakujacy[1][0], y_player_teammate_2=posortowani_atakujacy[1][1],
|
|
||||||
x_player_teammate_3=posortowani_atakujacy[2][0], y_player_teammate_3=posortowani_atakujacy[2][1],
|
|
||||||
x_player_teammate_4=posortowani_atakujacy[3][0], y_player_teammate_4=posortowani_atakujacy[3][1],
|
|
||||||
x_player_teammate_5=posortowani_atakujacy[4][0], y_player_teammate_5=posortowani_atakujacy[4][1],
|
|
||||||
x_player_teammate_6=posortowani_atakujacy[5][0], y_player_teammate_6=posortowani_atakujacy[5][1],
|
|
||||||
x_player_teammate_7=posortowani_atakujacy[6][0], y_player_teammate_7=posortowani_atakujacy[6][1],
|
|
||||||
x_player_teammate_8=posortowani_atakujacy[7][0], y_player_teammate_8=posortowani_atakujacy[7][1],
|
|
||||||
x_player_teammate_9=posortowani_atakujacy[8][0], y_player_teammate_9=posortowani_atakujacy[8][1],
|
|
||||||
x_player_teammate_10=posortowani_atakujacy[9][0], y_player_teammate_10=posortowani_atakujacy[9][1])
|
|
||||||
|
|
||||||
# response = xgboost_predict_proba(shooter = shooter,
|
|
||||||
# opponentsList = opponentsList, teamMatesList = teamMatesList, minute = 20, position_name = position_name, shot_body_part_name = body_part, shot_technique_name = technique,
|
|
||||||
# shot_type_name = acionType, shot_first_time = False,
|
|
||||||
# shot_aerial_won = False, shot_deflected = False, shot_open_goal = False,
|
|
||||||
# shot_follows_dribble = False, shot_redirect = False, shot_kick_off = False, goalkeeper= goalkepper
|
|
||||||
# )
|
|
||||||
|
|
||||||
#print(response)
|
#print(response)
|
||||||
res = str(response)
|
res = str(response)
|
||||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -14,45 +14,9 @@
|
|||||||
border-radius: 5px; /* Lekko zaokrąglone rogi */
|
border-radius: 5px; /* Lekko zaokrąglone rogi */
|
||||||
font-size: 20px; /* Duża, czytelna czcionka */
|
font-size: 20px; /* Duża, czytelna czcionka */
|
||||||
font-weight: bold; /* Pogrubienie dla lepszej widoczności */
|
font-weight: bold; /* Pogrubienie dla lepszej widoczności */
|
||||||
width: 100%; /* Poszerzone pole */
|
width: 50%; /* Dostosuj szerokość zgodnie z potrzebami */
|
||||||
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5); /* Cień dla dodatkowej głębi */
|
/* Dodatkowe style, takie jak cienie, mogą być dodane */
|
||||||
/* Opcjonalnie, można dodać gradient tła dla większego efektu */
|
|
||||||
background-image: linear-gradient(to right, #32CD32 , #4CAF50);
|
|
||||||
transition: transform 0.3s ease; /* Delikatna animacja */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Ex:hover {
|
|
||||||
transform: scale(1.10); /* Efekt powiększenia przy najechaniu */
|
|
||||||
}
|
|
||||||
|
|
||||||
.xg-meter {
|
|
||||||
width: 200px;
|
|
||||||
height: 100px; /* Zmiana wysokości, aby pasowała do proporcji bramki */
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
text-align: center;
|
|
||||||
color: white;
|
|
||||||
font-size: 48px;
|
|
||||||
font-weight: bold;
|
|
||||||
background: url('assets/bramka.jpeg') no-repeat center center; /* Tło z obrazem bramki */
|
|
||||||
background-size: cover; /* Dopasowanie obrazu do rozmiaru elementu */
|
|
||||||
border-radius: 10px; /* Opcjonalnie, dla zaokrąglonych rogów */
|
|
||||||
}
|
|
||||||
|
|
||||||
.xg-value {
|
|
||||||
display: block;
|
|
||||||
background: rgba(0, 0, 0, 0.5); /* Półprzezroczyste tło dla lepszej czytelności tekstu */
|
|
||||||
padding: 5px 10px; /* Dodanie odstępu */
|
|
||||||
border-radius: 5px; /* Zaokrąglone rogi dla tekstu */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Funkcja JavaScript będzie sterować stopniem gradientu */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 50px;
|
margin: 50px;
|
||||||
display: grid;
|
display: grid;
|
||||||
@ -98,7 +62,6 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.player{
|
.player{
|
||||||
width: inherit;
|
width: inherit;
|
||||||
height: 8vh;
|
height: 8vh;
|
||||||
@ -132,15 +95,14 @@
|
|||||||
background-color: #f0f0f0; /* Example background color */
|
background-color: #f0f0f0; /* Example background color */
|
||||||
z-index: 1000; /* Ensure it stays on top of other content */
|
z-index: 1000; /* Ensure it stays on top of other content */
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-list{
|
.player-list{
|
||||||
background-color: rgb(61, 38, 38);
|
background-color: rgb(61, 38, 38);
|
||||||
width: 13vw;
|
width: 13vw;
|
||||||
height: calc(50vw*68/105);
|
height: calc(50vw*68/105);
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
font-size: 12px; /* Example font size - adjust as needed */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
.top-bar {
|
.top-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -276,37 +238,6 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.additional-parameters {
|
|
||||||
position: relative; /* Or absolute, depending on layout */
|
|
||||||
right: 0;
|
|
||||||
top: 30%; /* Adjusted to a higher position */
|
|
||||||
width: 250px; /* Increased width */
|
|
||||||
background-color: #000000;
|
|
||||||
padding: 15px; /* Increased padding */
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
|
||||||
z-index: 100; /* To ensure it stays on top */
|
|
||||||
color: #ffffff; /* Optional: change text color for better visibility on dark background */
|
|
||||||
}
|
|
||||||
|
|
||||||
.additional-parameters h3 {
|
|
||||||
margin-top: 0;
|
|
||||||
font-size: 18px; /* Increased font size for heading */
|
|
||||||
}
|
|
||||||
|
|
||||||
.additional-parameters label {
|
|
||||||
display: flex; /* Updated to flex for better alignment */
|
|
||||||
align-items: center; /* Aligns checkbox and label text vertically */
|
|
||||||
margin-bottom: 10px; /* Increased spacing between checkboxes */
|
|
||||||
font-size: 16px; /* Increased font size for labels */
|
|
||||||
}
|
|
||||||
|
|
||||||
.additional-parameters input[type="checkbox"] {
|
|
||||||
margin-right: 10px; /* Adds spacing between checkbox and label text */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* DROPDOWNS */
|
/* DROPDOWNS */
|
||||||
/* Style the dropdown button */
|
/* Style the dropdown button */
|
||||||
.dropbtn {
|
.dropbtn {
|
||||||
|
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.
@ -345,5 +345,5 @@ cols <- names(data3_final)[grepl(pattern, names(data3_final))]
|
|||||||
data_final <- data3_final %>% unnest(all_of(cols))
|
data_final <- data3_final %>% unnest(all_of(cols))
|
||||||
skimr::skim(data_final)
|
skimr::skim(data_final)
|
||||||
write_csv(data_final, file = "data/final_data.csv")
|
write_csv(data_final, file = "data/final_data.csv")
|
||||||
#df_test <- read.csv("data/final_data.csv", nrows = 10000)
|
df_test <- read.csv("data/final_data.csv", nrows = 1000)
|
||||||
##################### The fourth dataset ##############################
|
##################### The fourth dataset ##############################
|
||||||
|
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