v3
This commit is contained in:
parent
20395941dc
commit
19b7f6b344
@ -3,6 +3,9 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="0fc070d1-3753-43f5-b5e7-37c2bc110b95" name="Default Changelist" comment="">
|
<list default="true" id="0fc070d1-3753-43f5-b5e7-37c2bc110b95" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/matches_list.csv" beforeDir="false" afterPath="$PROJECT_DIR$/matches_list.csv" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/teams_list.csv" beforeDir="false" afterPath="$PROJECT_DIR$/teams_list.csv" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/worker.fcl" beforeDir="false" afterPath="$PROJECT_DIR$/worker.fcl" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/worker.fcl" beforeDir="false" afterPath="$PROJECT_DIR$/worker.fcl" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -89,38 +92,42 @@
|
|||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state x="291" y="120" key="#com.intellij.execution.impl.EditConfigurationsDialog/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591713379914" />
|
<state x="291" y="120" key="#com.intellij.execution.impl.EditConfigurationsDialog/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591713379914" />
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.bottom" timestamp="1591785983186">
|
<state width="1510" height="218" key="GridCell.Tab.0.bottom" timestamp="1592216066059">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.bottom/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785983186" />
|
<state width="1510" height="218" key="GridCell.Tab.0.bottom/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592216066059" />
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.center" timestamp="1591785983186">
|
<state width="1510" height="218" key="GridCell.Tab.0.center" timestamp="1592216066058">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.center/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785983186" />
|
<state width="1510" height="218" key="GridCell.Tab.0.center/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592216066058" />
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.left" timestamp="1591785983186">
|
<state width="1510" height="218" key="GridCell.Tab.0.left" timestamp="1592216066057">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.left/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785983186" />
|
<state width="1510" height="218" key="GridCell.Tab.0.left/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592216066057" />
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.right" timestamp="1591785983186">
|
<state width="1510" height="218" key="GridCell.Tab.0.right" timestamp="1592216066059">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="246" key="GridCell.Tab.0.right/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785983186" />
|
<state width="1510" height="218" key="GridCell.Tab.0.right/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592216066059" />
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.bottom" timestamp="1591785311471">
|
<state width="1510" height="207" key="GridCell.Tab.1.bottom" timestamp="1592215668952">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.bottom/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785311471" />
|
<state width="1510" height="207" key="GridCell.Tab.1.bottom/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592215668952" />
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.center" timestamp="1591785311468">
|
<state width="1510" height="207" key="GridCell.Tab.1.center" timestamp="1592215668952">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.center/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785311468" />
|
<state width="1510" height="207" key="GridCell.Tab.1.center/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592215668952" />
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.left" timestamp="1591785311468">
|
<state width="1510" height="207" key="GridCell.Tab.1.left" timestamp="1592215668952">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.left/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785311468" />
|
<state width="1510" height="207" key="GridCell.Tab.1.left/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592215668952" />
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.right" timestamp="1591785311471">
|
<state width="1510" height="207" key="GridCell.Tab.1.right" timestamp="1592215668952">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1510" height="272" key="GridCell.Tab.1.right/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1591785311471" />
|
<state width="1510" height="207" key="GridCell.Tab.1.right/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592215668952" />
|
||||||
|
<state width="766" height="437" key="XDebugger.FullValuePopup" timestamp="1592211406584">
|
||||||
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
|
</state>
|
||||||
|
<state width="766" height="437" key="XDebugger.FullValuePopup/67.27.1533.873/1600.0.1920.1080@67.27.1533.873" timestamp="1592211406584" />
|
||||||
<state x="376" y="181" width="904" height="562" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2" timestamp="1591723368763">
|
<state x="376" y="181" width="904" height="562" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2" timestamp="1591723368763">
|
||||||
<screen x="67" y="27" width="1533" height="873" />
|
<screen x="67" y="27" width="1533" height="873" />
|
||||||
</state>
|
</state>
|
||||||
@ -130,10 +137,9 @@
|
|||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||||
<condition expression="i==627" language="Python" />
|
|
||||||
<url>file://$PROJECT_DIR$/main.py</url>
|
<url>file://$PROJECT_DIR$/main.py</url>
|
||||||
<line>10</line>
|
<line>98</line>
|
||||||
<option name="timeStamp" value="13" />
|
<option name="timeStamp" value="19" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
|
70
main.py
70
main.py
@ -2,6 +2,8 @@ from fcl_parser import FCLParser
|
|||||||
import skfuzzy.control as ctrl
|
import skfuzzy.control as ctrl
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
s1 = '2018/2019'
|
||||||
|
s2 = '2019/2020'
|
||||||
teams = pd.read_csv('teams_list.csv')
|
teams = pd.read_csv('teams_list.csv')
|
||||||
matches = pd.read_csv('matches_list.csv')
|
matches = pd.read_csv('matches_list.csv')
|
||||||
|
|
||||||
@ -11,16 +13,66 @@ for i in range(0,matches.shape[0]):
|
|||||||
team1 = matches['Team1'][i][:-1]
|
team1 = matches['Team1'][i][:-1]
|
||||||
team2 = matches['Team2'][i][1:-1]
|
team2 = matches['Team2'][i][1:-1]
|
||||||
gameweek = matches['Gameweek'][i]
|
gameweek = matches['Gameweek'][i]
|
||||||
|
season = matches['Season'][i]
|
||||||
|
|
||||||
|
points2017 = {
|
||||||
|
"Legia Warszawa": 70,
|
||||||
|
"Jagiellonia Białystok": 67,
|
||||||
|
"Lech Poznań": 60,
|
||||||
|
"Górnik Zabrze": 60,
|
||||||
|
"Wisła Płock": 57,
|
||||||
|
"Wisła Kraków": 55,
|
||||||
|
"Zagłębie Lubin": 52,
|
||||||
|
"Korona Kielce": 49,
|
||||||
|
"Cracovia Kraków": 50,
|
||||||
|
"Śląsk Wrocław": 50,
|
||||||
|
"Pogoń Szczecin": 45,
|
||||||
|
"Arka Gdynia": 43,
|
||||||
|
"Lechia Gdańsk": 39,
|
||||||
|
"Piast Gliwice": 37,
|
||||||
|
"Miedź Legnica": 35,
|
||||||
|
"Zagłębie Sosnowiec": 35,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if((team1 not in not_in_df) and (team2 not in not_in_df)):
|
if((team1 not in not_in_df) and (team2 not in not_in_df)):
|
||||||
try:
|
try:
|
||||||
form_1 = teams.loc[ (teams['Team'] == team1) & (teams['Gameweek'] == gameweek)].Form.values[0]
|
|
||||||
temp_1 = teams.loc[ (teams['Team'] == team1) & (teams['Gameweek'] == gameweek)].Points.values[0]
|
form_1 = teams.loc[(teams['Team'] == team1) & (teams['Gameweek'] == gameweek) & (teams['Season'] == season)].Form.values[0]
|
||||||
form_2 = teams.loc[ (teams['Team'] == team2) & (teams['Gameweek'] == gameweek)].Form.values[0]
|
temp_1 = teams.loc[(teams['Team'] == team1) & (teams['Gameweek'] == gameweek) & (teams['Season'] == season)].Points.values[0]
|
||||||
temp_2 = teams.loc[ (teams['Team'] == team2) & (teams['Gameweek'] == gameweek)].Points.values[0]
|
xGform_1 = teams.loc[(teams['Team'] == team1) & (teams['Gameweek'] == gameweek) & (teams['Season'] == season)].xGform.values[0]
|
||||||
|
|
||||||
|
form_2 = teams.loc[(teams['Team'] == team2) & (teams['Gameweek'] == gameweek) & (teams['Season'] == season)].Form.values[0]
|
||||||
|
temp_2 = teams.loc[(teams['Team'] == team2) & (teams['Gameweek'] == gameweek) & (teams['Season'] == season)].Points.values[0]
|
||||||
|
xGform_2 = teams.loc[(teams['Team'] == team2) & (teams['Gameweek'] == gameweek) & (teams['Season'] == season)].xGform.values[0]
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print(team1 + team2 + str(gameweek))
|
print(team1 + team2 + str(gameweek))
|
||||||
|
|
||||||
points = temp_1 - temp_2
|
if ((gameweek < 7) & (season==s1)):
|
||||||
|
try:
|
||||||
|
t1 = points2017[team1]
|
||||||
|
except:
|
||||||
|
t1 = 35
|
||||||
|
try:
|
||||||
|
t2 = points2017[team2]
|
||||||
|
except:
|
||||||
|
t2 = 35
|
||||||
|
points = t1 - t2
|
||||||
|
|
||||||
|
elif ((gameweek < 7) & (season==s2)):
|
||||||
|
try:
|
||||||
|
t1 = teams.loc[(teams['Team'] == team1) & (teams['Gameweek'] == 37) & (teams['Season'] == s1)].Points.values[0]
|
||||||
|
except:
|
||||||
|
t1 = 35
|
||||||
|
try:
|
||||||
|
t2 = teams.loc[(teams['Team'] == team2) & (teams['Gameweek'] == 37) & (teams['Season'] == s1)].Points.values[0]
|
||||||
|
except:
|
||||||
|
t2 = 35
|
||||||
|
points = t1 - t2
|
||||||
|
else:
|
||||||
|
points = temp_1 - temp_2
|
||||||
|
#0.365234375
|
||||||
|
|
||||||
temp = teams.loc[ (teams['Team'] == team1) & (teams['Gameweek'] == gameweek)].Result.values[0]
|
temp = teams.loc[ (teams['Team'] == team1) & (teams['Gameweek'] == gameweek)].Result.values[0]
|
||||||
ground_truth = 0
|
ground_truth = 0
|
||||||
@ -30,7 +82,7 @@ for i in range(0,matches.shape[0]):
|
|||||||
ground_truth = 0
|
ground_truth = 0
|
||||||
else:
|
else:
|
||||||
ground_truth = 1
|
ground_truth = 1
|
||||||
matches_input.append([form_1, form_2, points, ground_truth])
|
matches_input.append([form_1, form_2, points, xGform_1, xGform_2, ground_truth])
|
||||||
|
|
||||||
p = FCLParser() # Create the parser
|
p = FCLParser() # Create the parser
|
||||||
p.read_fcl_file('worker.fcl')
|
p.read_fcl_file('worker.fcl')
|
||||||
@ -42,6 +94,8 @@ for i in range(0,matches.shape[0]):
|
|||||||
module.input['form1'] = matches_input[i][0]
|
module.input['form1'] = matches_input[i][0]
|
||||||
module.input['form2'] = matches_input[i][1]
|
module.input['form2'] = matches_input[i][1]
|
||||||
module.input['points'] = matches_input[i][2]
|
module.input['points'] = matches_input[i][2]
|
||||||
|
module.input['xGform1'] = matches_input[i][3]
|
||||||
|
module.input['xGform2'] = matches_input[i][4]
|
||||||
module.compute()
|
module.compute()
|
||||||
x = module.output['result']
|
x = module.output['result']
|
||||||
x = float("{:.4f}".format(x))
|
x = float("{:.4f}".format(x))
|
||||||
@ -54,12 +108,12 @@ for i in range(0,matches.shape[0]):
|
|||||||
else:
|
else:
|
||||||
y = 0
|
y = 0
|
||||||
predictions.append(y)
|
predictions.append(y)
|
||||||
print("|FCL: " +str(x) + "|ROUND: " + str(y) + "|GROUND: " + str(matches_input[i][3]) + "|PKT DIFFERENCE: " + str(matches_input[i][2])+'|')
|
print("|FCL: " +str(x) + "|ROUND: " + str(y) + "|GROUND: " + str(matches_input[i][5]) + "|PKT DIFFERENCE: " + str(matches_input[i][2])+'|')
|
||||||
|
|
||||||
num = 0
|
num = 0
|
||||||
cor = 0
|
cor = 0
|
||||||
for i in range(0,matches.shape[0]):
|
for i in range(0,matches.shape[0]):
|
||||||
if(predictions[i]==matches_input[i][3]):
|
if(predictions[i]==matches_input[i][5]):
|
||||||
cor+=1
|
cor+=1
|
||||||
num+=1
|
num+=1
|
||||||
else:
|
else:
|
||||||
|
1342
matches_list.csv
1342
matches_list.csv
File diff suppressed because it is too large
Load Diff
2606
teams_list.csv
2606
teams_list.csv
File diff suppressed because it is too large
Load Diff
22
worker.fcl
22
worker.fcl
@ -4,6 +4,8 @@ VAR_INPUT
|
|||||||
form1: REAL;
|
form1: REAL;
|
||||||
form2: REAL;
|
form2: REAL;
|
||||||
points: REAL;
|
points: REAL;
|
||||||
|
xGform1: REAL;
|
||||||
|
xGform2: REAL;
|
||||||
END_VAR
|
END_VAR
|
||||||
|
|
||||||
VAR_OUTPUT
|
VAR_OUTPUT
|
||||||
@ -31,6 +33,18 @@ FUZZIFY points
|
|||||||
TERM high := (10,0)(20,1);
|
TERM high := (10,0)(20,1);
|
||||||
END_FUZZIFY
|
END_FUZZIFY
|
||||||
|
|
||||||
|
FUZZIFY xGform1
|
||||||
|
RANGE := (-15.000 .. 15.000);
|
||||||
|
TERM luck := (-5,1)(-2,0);
|
||||||
|
TERM badluck := (2,0)(5,1);
|
||||||
|
END_FUZZIFY
|
||||||
|
|
||||||
|
FUZZIFY xGform2
|
||||||
|
RANGE := (-15.000 .. 15.000);
|
||||||
|
TERM luck := (-5,1)(-2,0);
|
||||||
|
TERM badluck := (2,0)(5,1);
|
||||||
|
END_FUZZIFY
|
||||||
|
|
||||||
DEFUZZIFY result
|
DEFUZZIFY result
|
||||||
RANGE := (-1.000 .. 1.000);
|
RANGE := (-1.000 .. 1.000);
|
||||||
TERM home := (-1,1) (0,0);
|
TERM home := (-1,1) (0,0);
|
||||||
@ -46,13 +60,16 @@ RULEBLOCK
|
|||||||
ACCU : MAX;
|
ACCU : MAX;
|
||||||
ACT : MIN;
|
ACT : MIN;
|
||||||
|
|
||||||
// aktualny wynik 0.364734
|
// 0.365234375
|
||||||
|
|
||||||
//tego nic nie daje
|
//tego nic nie daje
|
||||||
RULE 0 : if form1 is great and form2 is bad then result is home
|
RULE 0 : if form1 is great and form2 is bad then result is home
|
||||||
// rozbicie home
|
// rozbicie home
|
||||||
RULE 3 : if form1 is great and form2 is avg and points is low then result is draw
|
RULE 3 : if form1 is great and form2 is avg and points is low then result is draw
|
||||||
|
|
||||||
|
RULE 1 : if form1 is great and form2 is avg and points is avg and (xGform1 is luck or xGform2 is badluck) then result is draw
|
||||||
RULE 4 : if form1 is great and form2 is avg and points is avg then result is home
|
RULE 4 : if form1 is great and form2 is avg and points is avg then result is home
|
||||||
|
|
||||||
|
RULE 2 : if form1 is great and form2 is avg and points is high and (xGform1 is luck or xGform2 is badluck) then result is draw
|
||||||
RULE 5 : if form1 is great and form2 is avg and points is high then result is home
|
RULE 5 : if form1 is great and form2 is avg and points is high then result is home
|
||||||
//rozbicie
|
//rozbicie
|
||||||
RULE 6 : if form1 is great and form2 is great and points is low then result is away
|
RULE 6 : if form1 is great and form2 is great and points is low then result is away
|
||||||
@ -72,6 +89,7 @@ RULEBLOCK
|
|||||||
RULE 37 : if form1 is avg and form2 is great and points is low then result is away
|
RULE 37 : if form1 is avg and form2 is great and points is low then result is away
|
||||||
RULE 38 : if form1 is avg and form2 is great and points is avg then result is draw
|
RULE 38 : if form1 is avg and form2 is great and points is avg then result is draw
|
||||||
RULE 39 : if form1 is avg and form2 is great and points is high then result is home
|
RULE 39 : if form1 is avg and form2 is great and points is high then result is home
|
||||||
|
RULE 40 : if form1 is avg and form2 is great and points is high and (xGform1 is badluck or xGform2 is luck) then result is draw
|
||||||
// rozbicie
|
// rozbicie
|
||||||
RULE 61 : if form1 is bad and form2 is bad and points is low then result is away
|
RULE 61 : if form1 is bad and form2 is bad and points is low then result is away
|
||||||
RULE 62 : if form1 is bad and form2 is bad and points is avg then result is draw
|
RULE 62 : if form1 is bad and form2 is bad and points is avg then result is draw
|
||||||
|
Loading…
Reference in New Issue
Block a user