feedback update

This commit is contained in:
Mateusz Tylka 2023-01-03 13:45:59 +01:00
parent 69c93e95a3
commit 1332ae805f

View File

@ -4,34 +4,69 @@ FS = FuzzySystem()
# Define fuzzy sets for the variable # Define fuzzy sets for the variable
# RELEASE_YEAR
release_year_newer = FuzzySet(points=[[-68.0, 0.0], [68.0, 1.0]], term="newer")
release_year_similar = FuzzySet(points=[[-68.0, 0.0], [0.0, 1.0], [68.0, 0.0]], term="similar")
release_year_older = FuzzySet(points=[[-68.0, 1.0], [68.0, 0.0]], term="older")
FS.add_linguistic_variable("RELEASE_YEAR", LinguisticVariable( [release_year_newer, release_year_similar, release_year_older] ))
# release_year_newer = FuzzySet(points=[[-68.0, 0.0], [68.0, 1.0]], term="newer")
release_year_newer = TriangleFuzzySet(-68, -68, 0, term="newer")
# release_year_similar = FuzzySet(points=[[-68.0, 0.0], [0.0, 1.0], [68.0, 0.0]], term="similar")
release_year_similar = TriangleFuzzySet(-68, 0, 68, term="similar")
# release_year_older = FuzzySet(points=[[-68.0, 1.0], [68.0, 0.0]], term="older")
release_year_older = TriangleFuzzySet(0, 68, 68, term="older")
FS.add_linguistic_variable("RELEASE_YEAR", LinguisticVariable( [release_year_newer, release_year_similar, release_year_older], universe_of_discourse=[-136, 136] ))
# RUNTIME
runtime_shorter = FuzzySet(points=[[-238.0, 0.0], [238.0, 1.0]], term="shorter")
runtime_similar = FuzzySet(points=[[-238.0, 0.0], [0.0, 1.0], [238.0, 0.0]], term="similar")
runtime_longer = FuzzySet(points=[[-238.0, 1.0], [238.0, 0]], term="longer")
FS.add_linguistic_variable("RUNTIME", LinguisticVariable( [runtime_shorter, runtime_similar, runtime_longer] ))
# runtime_shorter = FuzzySet(points=[[-238.0, 0.0], [238.0, 1.0]], term="shorter")
runtime_shorter = TriangleFuzzySet(-238, -238, 0, term="shorter")
# runtime_similar = FuzzySet(points=[[-238.0, 0.0], [0.0, 1.0], [238.0, 0.0]], term="similar")
runtime_similar = TriangleFuzzySet(-238, 0, 238, term="similar")
# runtime_longer = FuzzySet(points=[[-238.0, 1.0], [238.0, 0]], term="longer")
runtime_longer = TriangleFuzzySet(0, 238, 238, term="longer")
FS.add_linguistic_variable("RUNTIME", LinguisticVariable( [runtime_shorter, runtime_similar, runtime_longer], universe_of_discourse=[-476, 476] ))
# SEASONS
seasons_less = FuzzySet(points=[[-42.0, 0.0], [42.0, 1.0]], term="less")
seasons_similar = FuzzySet(points=[[-42.0, 0.0], [0.0, 1.0], [42.0, 0.0]], term="similar")
seasons_more = FuzzySet(points=[[-42.0, 1.0], [42.0, 0.0]], term="more")
FS.add_linguistic_variable("SEASONS", LinguisticVariable( [seasons_less, seasons_similar, seasons_more] ))
# seasons_less = FuzzySet(points=[[-42.0, 0.0], [42.0, 1.0]], term="less")
seasons_less = TriangleFuzzySet(-42, -42, 0, term="less")
# seasons_similar = FuzzySet(points=[[-42.0, 0.0], [0.0, 1.0], [42.0, 0.0]], term="similar")
seasons_similar = TriangleFuzzySet(-42, 0, 42, term="similar")
# seasons_more = FuzzySet(points=[[-42.0, 1.0], [42.0, 0.0]], term="more")
seasons_more = TriangleFuzzySet(0, 42, 42, term="more")
FS.add_linguistic_variable("SEASONS", LinguisticVariable( [seasons_less, seasons_similar, seasons_more], universe_of_discourse=[-84, 84] ))
# GENRES
genres_different = FuzzySet(points=[[-100.0, 0.0], [100.0, 1.0]], term="different")
genres_similar = FuzzySet(points=[[-100.0, 0.0], [0.0, 1.0], [100.0, 0.0]], term="similar")
genres_same = FuzzySet(points=[[-100.0, 1.0], [100.0, 0.0]], term="same")
FS.add_linguistic_variable("GENRES", LinguisticVariable( [genres_different, genres_similar, genres_same] ))
# genres_different = FuzzySet(points=[[-100.0, 0.0], [100.0, 1.0]], term="different")
genres_different = TriangleFuzzySet(-100, -100, 0, term="different")
# genres_similar = FuzzySet(points=[[-100.0, 0.0], [0.0, 1.0], [100.0, 0.0]], term="similar")
genres_similar = TriangleFuzzySet(-100, 0, 100, term="similar")
# genres_same = FuzzySet(points=[[-100.0, 1.0], [100.0, 0.0]], term="same")
genres_same = TriangleFuzzySet(0, 100, 100, term="same")
FS.add_linguistic_variable("GENRES", LinguisticVariable( [genres_different, genres_similar, genres_same], universe_of_discourse=[-200, 200] ))
# EMOTIONS
emotions_different = FuzzySet(points=[[-4.0, 0.0], [4.0, 1.0]], term="different")
emotions_similar = FuzzySet(points=[[-4.0, 0.0], [0.0, 1.0], [4.0, 0.0]], term="similar")
emotions_same = FuzzySet(points=[[-4.0, 1.0], [4.0, 0.0]], term="same")
FS.add_linguistic_variable("EMOTIONS", LinguisticVariable( [emotions_different, emotions_similar, emotions_same] ))
# emotions_different = FuzzySet(points=[[-4.0, 0.0], [4.0, 1.0]], term="different")
emotions_different = TriangleFuzzySet(-4, -4, 0, term="different")
# emotions_similar = FuzzySet(points=[[-4.0, 0.0], [0.0, 1.0], [4.0, 0.0]], term="similar")
emotions_similar = TriangleFuzzySet(-4, 0, 4, term="similar")
# emotions_same = FuzzySet(points=[[-4.0, 1.0], [4.0, 0.0]], term="same")
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.set_crisp_output_value("low_recomendation", 0)
FS.set_crisp_output_value("medium_recomendation", 50)
@ -51,4 +86,4 @@ FS.set_variable("SEASONS", -2.0)
FS.set_variable("GENRES", 50.0)
FS.set_variable("EMOTIONS", 1.0)
print(FS.Sugeno_inference(["RECOMENDATION"]))
print(FS.inference(["RECOMENDATION"]))