compare_to_all_games #1

Merged
s444417 merged 9 commits from compare_to_all_games into master 2023-02-03 00:42:23 +01:00
4 changed files with 120 additions and 144 deletions
Showing only changes of commit 5d1d385ea4 - Show all commits

File diff suppressed because one or more lines are too long

View File

@ -14,6 +14,11 @@ it will generate .json file which can be presented by running all cells of `Fuzz
python main.py --pres -r True
#### Evaluation mode
python main.py --pres --eval
generates result.json file with 10 random games and 10 recomendations for each game, results can be evaluated in `Fuzzy_presentation.ipynb` file, with Jaccard Similiarity
Processed dataset files are already provided, but can be created from the base ``games.csv`` file by running:
python process_dataset.py

Binary file not shown.

12
main.py
View File

@ -100,19 +100,29 @@ def main(argv):
test_mode = False
random_mode = False
eval_mode = False
eval_random_mode = False
opts, args = getopt.getopt(argv, "r:", ["pres"])
opts, args = getopt.getopt(argv, "r:", ["pres", "eval", "evalrandom"])
for opt, arg in opts:
if "--pres" == opt:
test_mode = True
if "--eval" == opt:
eval_mode = True
if "--evalrandom" == opt:
eval_random_mode = True
if "-r" == opt:
random_mode = arg
if (True == test_mode):
game_list = ["Call of Duty®: Modern Warfare® 2", "Project CARS", "DayZ", "STAR WARS™ Jedi Knight - Mysteries of the Sith™", "Overcooked"]
if (random_mode): game_list = [random.choice(title_list)]
if (eval_mode or eval_random_mode): game_list = [random.choice(title_list) for i in range(10)]
result_dict = {"results": []}
for item in game_list:
if not eval_random_mode:
titles_results = calculate_similarities(game_title=item, title_list=title_list, df=df, test=test_mode)
if eval_random_mode:
titles_results = [{"title": random.choice(title_list)} for i in range(10)]
game_result = get_game_info_from_df(df, item)
game_result["fuzzy_similiar"] = [get_game_info_from_df(df, title_item["title"]) for title_item in titles_results[:10]]
result_dict["results"].append(game_result)