draw figure and review commends

This commit is contained in:
Mateusz 2023-01-04 14:09:37 +01:00
parent 1332ae805f
commit 3b5256110d
2 changed files with 5 additions and 1 deletions

View File

@ -68,6 +68,7 @@ emotions_same = TriangleFuzzySet(0, 4, 4, term="same")
FS.add_linguistic_variable("EMOTIONS", LinguisticVariable( [emotions_different, emotions_similar, emotions_same], universe_of_discourse=[-8, 8] )) FS.add_linguistic_variable("EMOTIONS", LinguisticVariable( [emotions_different, emotions_similar, emotions_same], universe_of_discourse=[-8, 8] ))
# Nie crisp tylko tak jak te powyżej zdefiniować
FS.set_crisp_output_value("low_recomendation", 0) FS.set_crisp_output_value("low_recomendation", 0)
FS.set_crisp_output_value("medium_recomendation", 50) FS.set_crisp_output_value("medium_recomendation", 50)
FS.set_crisp_output_value("high_recomendation", 100) FS.set_crisp_output_value("high_recomendation", 100)
@ -77,6 +78,7 @@ RULE2 = "IF (EMOTIONS IS different) AND (GENRES IS different) THEN (RECOMENDATIO
RULE3 = "IF (RELEASE_YEAR IS newer) AND (RUNTIME IS similar) AND (SEASONS IS less) THEN (RECOMENDATION IS medium_recomendation)" RULE3 = "IF (RELEASE_YEAR IS newer) AND (RUNTIME IS similar) AND (SEASONS IS less) THEN (RECOMENDATION IS medium_recomendation)"
RULE4 = "IF (EMOTIONS IS similar) AND (GENRES IS similar) THEN (RECOMENDATION IS medium_recomendation)" RULE4 = "IF (EMOTIONS IS similar) AND (GENRES IS similar) THEN (RECOMENDATION IS medium_recomendation)"
RULE5 = "IF (RELEASE_YEAR IS similar) AND (RUNTIME IS similar) AND (SEASONS IS similar) AND (EMOTIONS IS same) AND (GENRES IS same) THEN (RECOMENDATION IS high_recomendation)" RULE5 = "IF (RELEASE_YEAR IS similar) AND (RUNTIME IS similar) AND (SEASONS IS similar) AND (EMOTIONS IS same) AND (GENRES IS same) THEN (RECOMENDATION IS high_recomendation)"
# Z regułami trzeba eksperymentować, można porównywać ze scorem dla sprawdzania skuteczności
FS.add_rules([RULE1, RULE2, RULE3, RULE4, RULE5]) FS.add_rules([RULE1, RULE2, RULE3, RULE4, RULE5])
@ -86,4 +88,6 @@ FS.set_variable("SEASONS", -2.0)
FS.set_variable("GENRES", 50.0) FS.set_variable("GENRES", 50.0)
FS.set_variable("EMOTIONS", 1.0) FS.set_variable("EMOTIONS", 1.0)
print(FS.inference(["RECOMENDATION"])) print(FS.inference(["RECOMENDATION"]))
FS.produce_figure(outputfile='file.pdf')

BIN
file.pdf Normal file

Binary file not shown.