Compare commits
14 Commits
modServera
...
master
Author | SHA1 | Date | |
---|---|---|---|
811964e519 | |||
020857a1e7 | |||
2d338824f8 | |||
234d08d0c1 | |||
ffe2c13cdf | |||
7bbe593dde | |||
09ebd98fb4 | |||
|
9b7136b1af | ||
|
db214d217e | ||
|
3749cf22b0 | ||
5b3ae8684e | |||
378c897959 | |||
1b42cd208b | |||
412dd57577 |
BIN
Podręcznik użytkowania.pdf
Normal file
BIN
Podręcznik użytkowania.pdf
Normal file
Binary file not shown.
21
README.md
21
README.md
@ -1,4 +1,4 @@
|
|||||||
# Analiza piłkarska z aplikacją `CoachStats`
|
# Aplikacja `CoachStats`
|
||||||
|
|
||||||
## Wstęp
|
## Wstęp
|
||||||
|
|
||||||
@ -9,21 +9,18 @@ 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.
|
||||||
|
|
||||||
## Technologie
|
## Uruchomienie
|
||||||
|
|
||||||
## Instalacja i Uruchomienie
|
Aby uruchomić aktualną wersję aplikacji, wykonaj następujące kroki:
|
||||||
|
|
||||||
Aby uruchomić beta wersję aplikacji, wykonaj następujące kroki:
|
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.
|
||||||
|
|
||||||
1. **Uruchomienie Klienta:**
|
2. **Uruchomienie aplikacji webowej** Po wykonaiu kroku 1 można wejść na właściwą stronę [aplikacji](https://statgoals.onrender.com/).
|
||||||
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,11 +5,49 @@ import { Link } from "react-router-dom";
|
|||||||
|
|
||||||
const Hero = () => {
|
const Hero = () => {
|
||||||
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
|
||||||
const [gameMinute, setGameMinute] = useState('');
|
const [gameMinute, setGameMinute] = useState('');
|
||||||
|
|
||||||
const toggleDropdown = () => setIsOpen(!isOpen);
|
const [firstShot, setfirstShot] = useState(0);
|
||||||
const handleMinuteChange = (e) => setGameMinute(e.target.value);
|
const [oneOnOne, SetoneOnOne] = useState(0);
|
||||||
|
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
|
||||||
@ -17,10 +55,24 @@ const Hero = () => {
|
|||||||
//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(0);
|
const [number_of_defenders, setNumberOfDevenders] = useState(()=>{
|
||||||
const [number_of_strikers, setNumberOfStrikers] = useState(0)
|
return 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
|
||||||
|
|
||||||
@ -57,7 +109,6 @@ const Hero = () => {
|
|||||||
|
|
||||||
// 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')
|
||||||
@ -69,13 +120,20 @@ const Hero = () => {
|
|||||||
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
|
||||||
@ -86,14 +144,15 @@ const Hero = () => {
|
|||||||
list.removeChild(player)
|
list.removeChild(player)
|
||||||
bojo.removeChild(ball)
|
bojo.removeChild(ball)
|
||||||
if(possition == 1){
|
if(possition == 1){
|
||||||
setNumberOfGoalkeppers(0)
|
setNumberOfGoalkeppers(number_of_goalkeepers_rev.current -= 1);
|
||||||
}else if(possition == 2){
|
}else if(possition == 2){
|
||||||
setNumberOfDevenders(number_of_defenders-1) ;
|
setNumberOfDevenders(number_of_defenders_rev.current -= 1) ;
|
||||||
}else if (possition == 3){
|
}else if (possition == 3){
|
||||||
setNumberOfStrikers(number_of_strikers-1) ;
|
setNumberOfStrikers(number_of_strikers_rev.current -= 1);
|
||||||
}else if(possition == 0){
|
}else if(possition == 0){
|
||||||
setNumberOfShooters(0)
|
setNumberOfShooters(number_of_shooters_rev.current -= 1);
|
||||||
}
|
}
|
||||||
|
//sentQuestion()
|
||||||
}
|
}
|
||||||
|
|
||||||
// funkcja zsczytuje pozycje zawodnikow przed wyslaniem zapytania do serwera
|
// funkcja zsczytuje pozycje zawodnikow przed wyslaniem zapytania do serwera
|
||||||
@ -127,19 +186,22 @@ const Hero = () => {
|
|||||||
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"
|
||||||
@ -154,7 +216,7 @@ const Hero = () => {
|
|||||||
// 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 = "Lokalizacja: " + konwerturX(ball.style.left) + " m, " + konwetujY(ball.style.top) + " m";
|
posytion.innerHTML = 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')
|
||||||
@ -209,8 +271,8 @@ const Hero = () => {
|
|||||||
tekst.style.color = "white"
|
tekst.style.color = "white"
|
||||||
posytion.style.color = "white"
|
posytion.style.color = "white"
|
||||||
|
|
||||||
x = parseFloat(x) -2
|
x = parseFloat(x) -3
|
||||||
y = parseFloat(y) -2
|
y = parseFloat(y) -3
|
||||||
|
|
||||||
if(bojo.parentNode.querySelector(":hover")){
|
if(bojo.parentNode.querySelector(":hover")){
|
||||||
ball.style.left = x + "%"
|
ball.style.left = x + "%"
|
||||||
@ -219,32 +281,29 @@ const Hero = () => {
|
|||||||
//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(){
|
bojo.addEventListener("mouseup", function afterUp(){
|
||||||
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 == 1) {
|
if (number_of_shooters_rev.current == 1) {
|
||||||
console.log('Wysyłanie wartości: ', bodyPart, technique);
|
//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}`).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}&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(
|
||||||
res => res.json()
|
res => res.json()
|
||||||
).then(
|
).then(
|
||||||
data => {
|
data => {
|
||||||
@ -253,7 +312,7 @@ const Hero = () => {
|
|||||||
// 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);
|
||||||
@ -261,10 +320,9 @@ const Hero = () => {
|
|||||||
} 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*/
|
||||||
@ -285,36 +343,30 @@ const Hero = () => {
|
|||||||
//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 < 1 ){
|
if(number_of_shooters_rev.current < 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 < 1){
|
if ( number_of_goalkeepers_rev.current < 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 <= 10){
|
if(number_of_defenders_rev.current < 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 <= 10){
|
if(number_of_strikers_rev.current < 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
|
||||||
|
|
||||||
@ -343,11 +395,13 @@ const Hero = () => {
|
|||||||
<div className="container">
|
<div className="container">
|
||||||
{/* Listy zwijane */}
|
{/* Listy zwijane */}
|
||||||
|
|
||||||
<div className="top-bar">
|
<div className="top-bar" id = "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>
|
||||||
@ -360,7 +414,9 @@ const Hero = () => {
|
|||||||
|
|
||||||
|
|
||||||
<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>
|
||||||
@ -372,7 +428,9 @@ const Hero = () => {
|
|||||||
</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>
|
||||||
@ -382,7 +440,9 @@ const Hero = () => {
|
|||||||
</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>
|
||||||
@ -435,55 +495,40 @@ const Hero = () => {
|
|||||||
<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" />
|
<input type="checkbox" id="firstShot" onChange={handleFirstShotChange} />
|
||||||
Pierwszy w meczu
|
Pierwszy w meczu
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="oneOnOne" />
|
<input type="checkbox" id="oneOnOne" onChange={handleOneOnOneChange} />
|
||||||
Akcja sam na sam
|
Akcja sam na sam
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="afterAirDuel" />
|
<input type="checkbox" id="afterAirDuel" onChange={handleAfterAirDuelChange} />
|
||||||
Po pojedynku powietrznym
|
Po pojedynku powietrznym
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="openGoal" />
|
<input type="checkbox" id="openGoal" onChange={handleOpenGoalChange} />
|
||||||
Na pustą bramkę
|
Na pustą bramkę
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="afterDribbling" />
|
<input type="checkbox" id="afterDribbling" onChange={handleAfterDribblingChange} />
|
||||||
Poprzedzony dryblingiem
|
Poprzedzony dryblingiem
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="ricochet" />
|
<input type="checkbox" id="redirect" onChange={handleRedirectChange} />
|
||||||
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>
|
||||||
@ -493,9 +538,6 @@ const Hero = () => {
|
|||||||
<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>
|
||||||
);
|
);
|
||||||
|
BIN
app/src/flask-server/labelEncoder.joblib
Normal file
BIN
app/src/flask-server/labelEncoder.joblib
Normal file
Binary file not shown.
Binary file not shown.
BIN
app/src/flask-server/modele/__pycache__/modele.cpython-311.pyc
Normal file
BIN
app/src/flask-server/modele/__pycache__/modele.cpython-311.pyc
Normal file
Binary file not shown.
BIN
app/src/flask-server/modele/__pycache__/modele.cpython-312.pyc
Normal file
BIN
app/src/flask-server/modele/__pycache__/modele.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -3,6 +3,8 @@ 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):
|
||||||
@ -15,7 +17,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_deflected=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,
|
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,
|
||||||
@ -34,13 +36,17 @@ 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, shot_kick_off=False):
|
x_player_teammate_Goalkeeper=np.nan, y_player_teammate_Goalkeeper=np.nan):
|
||||||
|
|
||||||
model = load('xgboost.joblib')
|
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',
|
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_deflected', 'shot_open_goal',
|
'shot_aerial_won', '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',
|
||||||
@ -59,12 +65,11 @@ 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_deflected, shot_open_goal,
|
shot_aerial_won, 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,
|
||||||
@ -83,50 +88,67 @@ 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[['position_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']].astype('category')
|
'shot_body_part_name']].astype(int)
|
||||||
|
|
||||||
X_new['minute'] = X_new['minute'].astype(int)
|
|
||||||
|
|
||||||
|
# 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[['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',
|
'shot_redirect']] = X_new[['shot_first_time',
|
||||||
'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',
|
'shot_redirect']].astype(int)
|
||||||
'shot_kick_off']].astype(bool)
|
print(X_new)
|
||||||
|
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_deflected,shot_open_goal,
|
shot_technique_name,shot_type_name,shot_first_time,shot_aerial_won,shot_open_goal,
|
||||||
shot_follows_dribble,shot_redirect, shot_kick_off):
|
shot_follows_dribble,shot_redirect):
|
||||||
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_deflected',
|
'shot_one_on_one','shot_aerial_won',
|
||||||
'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',
|
||||||
@ -146,8 +168,7 @@ 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)
|
||||||
@ -183,7 +204,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_deflected,
|
shot_one_on_one,shot_aerial_won,
|
||||||
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,
|
||||||
@ -204,8 +225,7 @@ 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,6 +31,15 @@ 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(',')
|
||||||
|
|
||||||
@ -81,6 +90,9 @@ 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)
|
||||||
|
|
||||||
@ -112,9 +124,15 @@ 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):
|
||||||
@ -141,23 +159,55 @@ 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=1,
|
response = xgboost_predict_proba(minute=int(gameMinute), #minute=0,
|
||||||
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=False,
|
shot_first_time=shot_first_time,
|
||||||
shot_one_on_one=False,
|
shot_one_on_one=shot_one_on_one,
|
||||||
shot_aerial_won=False,
|
shot_aerial_won=shot_aerial_won,
|
||||||
shot_deflected=False,
|
shot_open_goal=shot_open_goal,
|
||||||
shot_open_goal=False,
|
shot_follows_dribble=shot_follows_dribble,
|
||||||
shot_follows_dribble=False,
|
shot_redirect=shot_redirect,
|
||||||
shot_redirect=False,
|
|
||||||
shot_kick_off=False,
|
|
||||||
x1=shooter_x, y1=shooter_y,
|
x1=shooter_x, y1=shooter_y,
|
||||||
number_of_players_opponents=0,
|
number_of_players_opponents=number_of_players_opponents,
|
||||||
number_of_players_teammates=0,
|
number_of_players_teammates=number_of_players_teammates,
|
||||||
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.
1
app/src/flask-server/xgboost.json
Normal file
1
app/src/flask-server/xgboost.json
Normal file
File diff suppressed because one or more lines are too long
@ -277,7 +277,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.additional-parameters {
|
.additional-parameters {
|
||||||
position: fixed; /* Or absolute, depending on layout */
|
position: relative; /* 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
Normal file
82822
data/final_data_new.csv
Normal file
File diff suppressed because it is too large
Load Diff
38343
data/final_data_old.csv
Normal file
38343
data/final_data_old.csv
Normal file
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
Normal file
38343
notebooks/final_data.csv
Normal file
File diff suppressed because it is too large
Load Diff
82822
notebooks/final_data_new.csv
Normal file
82822
notebooks/final_data_new.csv
Normal file
File diff suppressed because it is too large
Load Diff
38343
notebooks/final_data_old.csv
Normal file
38343
notebooks/final_data_old.csv
Normal file
File diff suppressed because it is too large
Load Diff
BIN
notebooks/labelEncoder.joblib
Normal file
BIN
notebooks/labelEncoder.joblib
Normal file
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