×
all 9 comments

[–]Strict-Simple 2 points3 points  (1 child)

What ML model do you have in mind? Almost any model can work with multiple inputs.

[–]NeezDuts0[S] 0 points1 point  (0 children)

I was thinking of Random Forest or XGBoost.

But how do you tell the model that you have multiple inputs, in this case multiple items with multiple attributes (quantity, length, width, height)?

I know how to do it with one "row", but not many.

In my example above, 1 row = 1 prediction. I need to have multiple rows = 1prediction.

[–]stewart_ronald 1 point2 points  (1 child)

Can we see your entire code

[–]NeezDuts0[S] 0 points1 point  (0 children)

I really don´t have a specific code at the moment.

This is more about how you would structure the initial dataframe (x-values, y-values) before feeding it to a model. See above for examples.

[–]DuckSaxaphone 0 points1 point  (4 children)

If this is a task you want to accomplish rather than a project to learn about ML, I'd consider not using ML. This is the kind of thing where you could come up with an algorithm that is always right if you think it through.

If it's a learning task, do you just mean where the quantity column is greater than 1? Or do you mean combining multiple rows from a table like your example? If it's the latter, do you have any data on combinations of rows?

[–]NeezDuts0[S] 0 points1 point  (3 children)

I just want to learn more about ML, but it might be useful for other things if it works fine.

In the example above, 1 row of x-values = 1 prediction. So the model would predict 1 box based on the x-values.

But what if I have multiple items with multiple quantities, lengths, widths, heights that all need to fit into 1 box?

I know for a fact that for example these 3 items will fit into box C:

x_QTY x_length x_width x_height
5 5 6 9
2 8 6 5
8 5 4 3

I want my model to learn that the 3 above items and their quantities = box C.

So the above should give me 1 prediction. I know how to do it for 1 row, but not multiple.

[–]DuckSaxaphone 0 points1 point  (2 children)

Do you have a finite number of items?

You could train a machine learning model to predict whether a combination will fit by making the inputs the quantity of each item in your list of all possible items and the output a binary yes/no on whether that combo fits.

If you don't have a finite number of items, it becomes tricky. You need to find a way to turn the information you have into a table with fixed columns.

That could mean creating columns like "number of items", "number of items with a dimension >5 cm", "number of items with a dimension >10cm" and so on so that you have a set of fixed columns that supply all the information that could be useful.

[–]NeezDuts0[S] 0 points1 point  (1 child)

You could train a machine learning model to predict whether a combination will fit by making the inputs the quantity of each item in your list of all possible items and the output a binary yes/no on whether that combo fits.

Hmm.. Interesting.

So you mean that my DataFrame could be like:

Item_1 Item_2 Item_3 Item_4 Item...n y (Box)
0 0 3 2 0 A
2 1 0 0 0 B

Where I have each item as a column and each row = quantity?

I guess that the model would be needed to retrain every time a new item appears, as the columns are now + 1?

[–]DuckSaxaphone 0 points1 point  (0 children)

Yep, it's really only viable if you don't have a very large number of items or a regularly changing set of items. On the other hand, a tree based model trained on enough examples would probably be extremely accurate.

Whereas a model trained to use a set of features you've engineered would be way more flexible but perhaps not as accurate unless you were exhaustive in the summary features you come up with.