This commit is contained in:
s460941 2020-06-04 21:29:51 +02:00
parent 7940bee468
commit cd40e018ae
4 changed files with 77 additions and 18 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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 afterPath="$PROJECT_DIR$/.idea/vcs.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$/worker.fcl" beforeDir="false" afterPath="$PROJECT_DIR$/worker.fcl" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -15,8 +20,12 @@
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1crcekCL4FTLhoGCTKkOfpvbDrP" />
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RunDashboard">
@ -72,4 +81,31 @@
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>39</line>
<option name="timeStamp" value="5" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>
<configuration name="PythonConfigurationType">
<watch expression="not_in_df" />
</configuration>
</watches-manager>
</component>
</project>

22
main.py
View File

@ -9,7 +9,7 @@ matches = pd.read_csv('matches_list.csv')
not_in_df = ['Miedź Legnica','Zagłębie Sosnowiec']
matches_input = []
for i in range(25,150):
for i in range(0,293):
team1 = matches['Team1'][i][:-1]
team2 = matches['Team2'][i][1:-1]
gameweek = matches['Gameweek'][i]
@ -36,9 +36,23 @@ p.read_fcl_file('worker.fcl')
cs1 = ctrl.ControlSystem(p.rules)
module = ctrl.ControlSystemSimulation(cs1)
for i in range(50,75):
predictions = []
for i in range(0,224):
module.input['form1'] = matches_input[i][0]
module.input['form2'] = matches_input[i][1]
module.input['points'] = matches_input[i][2]
#module.input['points'] = matches_input[i][2]
module.compute()
print(str(module.output['result']) +": " + str(matches_input[i][3]))
x = module.output['result']
y = int(x + (x % (1 if x >= 0 else -1)))
predictions.append(y)
print(str(y) +": " + str(matches_input[i][3]))
num = 0
cor = 0
for i in range(0,224):
if(predictions[i]==matches_input[i][3]):
cor+=1
num+=1
else:
num+=1
print(float(cor/num))

View File

@ -11,17 +11,17 @@ VAR_OUTPUT
END_VAR
FUZZIFY form1
RANGE := (0.000 .. 5.000);
TERM bad := (1,1)(3,0);
RANGE := (-1.000 .. 5.000);
TERM bad := (1,1)(2,0);
TERM avg := (1,0)(2,1)(3,1)(4,0);
TERM great := (3,0)(5,1);
TERM great := (4,0)(5,1);
END_FUZZIFY
FUZZIFY form2
RANGE := (0.000 .. 5.000);
TERM bad := (1,1)(3,0);
RANGE := (-1.000 .. 5.000);
TERM bad := (1,1)(2,0);
TERM avg := (1,0)(2,1)(3,1)(4,0);
TERM great := (3,0)(5,1);
TERM great := (4,0)(5,1);
END_FUZZIFY
FUZZIFY points
@ -46,13 +46,16 @@ RULEBLOCK
ACCU : MAX;
ACT : MIN;
RULE 1 : if form1 is great and form2 is bad then result is home
RULE 2 : if form1 is bad and form2 is great then result is away
RULE 3 : if form1 is avg and form2 is avg then result is draw
RULE 4 : if form1 is great and form2 is great and points is low then result is draw
RULE 5 : if form1 is great and form2 is avg and points is avg then result is away
RULE 6 : if form1 is avg and form2 is avg and points is high then result is home
RULE 7 : if form1 is avg and form2 is avg and points is low then result is away
RULE 8 : if points is avg then result is away
RULE 2 : if form1 is great and form2 is avg then result is home
RULE 3 : if form1 is great and form2 is great then result is draw
RULE 4 : if form1 is avg and form2 is bad then result is home
RULE 5 : if form1 is avg and form2 is avg then result is draw
RULE 6 : if form1 is avg and form2 is great then result is away
RULE 7 : if form1 is bad and form2 is bad then result is draw
RULE 8 : if form1 is bad and form2 is avg then result is away
RULE 9 : if form1 is bad and form2 is great then result is away
END_RULEBLOCK
END_FUNCTION_BLOCK