initial commit of project
This commit is contained in:
28
evaluation/find_ground_truth_ingredients.py
Normal file
28
evaluation/find_ground_truth_ingredients.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import json
|
||||
import random
|
||||
|
||||
def main():
|
||||
data_path = "data/"
|
||||
ingredients_path = "mult_ingredients_nice.json"
|
||||
with open(data_path + ingredients_path, "r") as whole_json_file:
|
||||
all_ingredients = json.load(whole_json_file)
|
||||
|
||||
rare = []
|
||||
frequent = []
|
||||
for ingredient in all_ingredients.keys():
|
||||
if all_ingredients[ingredient] >= 1000:
|
||||
frequent.append(ingredient)
|
||||
elif all_ingredients[ingredient] >= 100 and all_ingredients[ingredient] <= 200:
|
||||
rare.append(ingredient)
|
||||
|
||||
picked_rare = random.sample(rare, 10)
|
||||
picked_frequent = random.sample(frequent, 10)
|
||||
|
||||
print("rare: ")
|
||||
print(picked_rare)
|
||||
print("\nfrequent: ")
|
||||
print(picked_frequent)
|
||||
|
||||
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user