C1M4_Assignment 4.3 Filtering by metadata (NOT GRADED Cell of graded lab). A quick suggestion about the filter logic πŸ€”

Hello everyone again ! :waving_hand: :smiley:

While going through the code for the get_relevant_products_from_query function, I noticed a few tiny details and wanted to kindly ask :smiling_face: for some clarification to make sure I understand the logic correctly. I suspect there might be a couple of minor bugs, but I’d love to hear your thoughts! :face_with_monocle:

Here is what I observed:

  1. Duplicate Item: In the importance_order list, the item 'masterCategory' is written twice. I assume this is just a small typo? :sweat_smile: importance_order = ['baseColour', 'masterCategory', 'usage', 'masterCategory', 'season', 'gender']

  2. Filter Reduction Logic: In the loop where the code tries to broaden the search by reducing filters, the logic is: filtered_filters = [x for x in filters if x.target not in importance_order[i+1:]] If I understand correctly, when i=0, it excludes almost all targets and only keeps the first one ('baseColour'). Then, as i increases, it starts adding the filters back. Doesn’t this mean it goes from the broadest search to the narrowest? Shouldn’t it ideally drop the least important filters one by one instead?

I might be completely wrong here, so please feel free to correct me! Just wanted to share my observations in case it helps improve the code.

Thanks again for the great course and for your time! :folded_hands: Happy learning to everyone! :sparkles:

@ulyaaliyeva206

is this ungraded lab? if yes then kindly select relative tags. I.did notice Not graded part but I wanted to make sure before I check the section, or did you mean non-graded cell from graded lab assignment C1 M4?

non graded cell from graded lab