# How to input sets as features

Need advice on the best way to represent the below data to be fed into an ML algorithm (yet to decided on)

This is from the online order processing domain. An order consists of a set of variable number of items. Each item can be located in different warehouses, again this is a variable number. The entire order with multiple items and items with multiple warehouses per item, needs to be processed as one training sample. The goal is to learn a function that outputs the warehouses from which the items can be picked under some rules/conditions to minimize processing costs. The number of items can run in millions and stores in 1000's.

I've been looking at representing these as permutation invariant sets - is there a simpler way or is that the right way to go about it ?

• I think mathematical optimization (en.wikipedia.org/wiki/Mathematical_optimization) is a better solution than ML. There does not seem to be a prediction/uncertainty. There is an objective that is being minimized and constraints. – Craig Nov 19 '20 at 12:07
• Thanks Craig for that. You are correct that this is indeed a combinatorial optimization problem. We do have solutions in place that are already doing this. However this is an experiment to see if we can train a model to learn from the data from the optimizer – Tana Nov 19 '20 at 12:24

In ML you really need good examples and then things for which you don't know the outcome. You learn from the good examples and then apply this "knowledge" to the examples for which you wish to know the outcome.

I agree that Mathematical Optimisation would probably be a better route to take in a problem such as this.

Alternatively, if you want to imply some kind of connection between sets, you could create a categorical (dummy) variable that designates such. If I understand you correctly here is an example

         item1    item2   basket1  basket2  basket3  GroundTruth (target)
order 1  Banana   Apple   True     False    False    warehouse1
order 2  Toy      Carrot  False    True     False    warehouse2
order 3  Picture  Shoe    False    False    True     warehouse3


You could also include the items in the warehouses in a similar way though if you have lots of different items, lots of warehouses, lots of baskets and not relatively enough training example this is going to get pretty sparse pretty quickly.

• Thanks for your comment and pls look at my reply above. This is in line with some of the papers out there that are using novel approaches of neural nets to solve optimization problems. One of them is the TSP problem that at least in research has had a good result – Tana Nov 19 '20 at 12:26
• Do you have good example from which to learn? – Taylrl Nov 19 '20 at 12:27
• Yes, optimization solvers that are solving this problem using lp/milp are available and that data is what is going to be fed to ML - that is the idea anyway – Tana Nov 19 '20 at 12:29
• Ultimately you need a ground truth from which to learn. How you get that is up to you but I dont really see the point in using lp/milp to get one to then feed into a model. Why not just go with the output from the lp/milp? – Taylrl Nov 19 '20 at 12:32
• We already have the data - this is an experiment to see if we can get away with lower accuracy and more wiggle room with feature manipulation with ML so we can try out various combinations of inputs/features that are currently not feasible with the existing solution – Tana Nov 19 '20 at 12:36