Below is some sample data limited to few examples only out of >1000. First picture is a colored print-screen of a table to highlight different categories: main, macro-, micro-categories & below the picture is a raw data.
The objective is:
- User enters two (can be one or even all) macro-categories (e.g. Citrus and Leafy green)
- For these macro-categories (which were entered) the model returns top best matches
- I am afraid that if I train a model (RF or SVM) over whole dataset, using macr- and micro-categories as different features in the model -> the model could predict micro-category not related to the macro-category (e.g. I will get as a result Oranges (Citrus), but I entered to the model only Berries and Melons).

Main_class |
Macro_class |
Micro_class |
Performance |
Usage |
Experience |
Fruits |
Berries |
Blueberries |
1 |
0.5 |
6.05 |
Fruits |
Berries |
Raspberries |
2 |
1 |
12.1 |
Fruits |
Berries |
Goji berries |
3 |
1.5 |
18.15 |
Fruits |
Berries |
Strawberries |
4 |
2 |
24.2 |
Fruits |
Berries |
Bilberries |
5 |
2.5 |
30.25 |
Fruits |
Berries |
Açaí berries |
6 |
3 |
36.3 |
Fruits |
Berries |
Cranberries |
7 |
3.5 |
42.35 |
Fruits |
Berries |
Grapes |
8 |
4 |
48.4 |
Fruits |
Citrus |
oranges |
21 |
10.5 |
127.05 |
Fruits |
Citrus |
grapefruits |
23 |
11.5 |
139.15 |
Fruits |
Citrus |
mandarins |
25 |
12.5 |
151.25 |
Fruits |
Citrus |
limes |
27 |
13.5 |
163.35 |
Fruits |
Stone fruit |
nectarines |
6 |
3 |
36.3 |
Fruits |
Stone fruit |
apricots |
7 |
3.5 |
42.35 |
Fruits |
Stone fruit |
peaches |
8 |
4 |
48.4 |
Fruits |
Stone fruit |
plums |
9 |
4.5 |
54.45 |
Fruits |
Melons |
watermelons |
2 |
1 |
12.1 |
Fruits |
Melons |
rockmelons |
3 |
1.5 |
18.15 |
Fruits |
Melons |
honeydew melons |
4 |
2 |
24.2 |
Vegetables |
Leafy green |
lettuce |
25 |
12.5 |
151.25 |
Vegetables |
Leafy green |
spinach |
27 |
13.5 |
163.35 |
Vegetables |
Leafy green |
silverbeet |
6 |
3 |
36.3 |
Vegetables |
Cruciferous |
cabbage |
7 |
3.5 |
42.35 |
Vegetables |
Cruciferous |
cauliflower |
8 |
4 |
48.4 |
Vegetables |
Cruciferous |
Brussels sprouts |
25 |
12.5 |
151.25 |
Vegetables |
Cruciferous |
broccoli |
27 |
13.5 |
163.35 |
Vegetables |
Marrow |
pumpkin |
6 |
3 |
36.3 |
Vegetables |
Marrow |
cucumber |
7 |
3.5 |
42.35 |
Vegetables |
Marrow |
zucchini |
8 |
4 |
48.4 |
Vegetables |
Allium |
onion |
5 |
2.5 |
30.25 |
Vegetables |
Allium |
garlic |
6 |
3 |
36.3 |
Vegetables |
Allium |
shallot |
7 |
3.5 |
42.35 |