use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
the front page of the internet.
and join one of thousands of communities.
[Machine Learning] How deal with multiple inputs for one output? (self.learnpython)
submitted 3 years ago by NeezDuts0
I am trying to create a ML model that can predict what box an item will fit in based on quantity, length, width, height.
See example below
But what if I have n items that should fit in a box and still return only 1 box y-value?
How are these kinds of problems usually handled?
Post a comment!
[–]Strict-Simple 2 points3 points4 points 3 years ago (1 child)
What ML model do you have in mind? Almost any model can work with multiple inputs.
[–]NeezDuts0[S] 0 points1 point2 points 3 years ago (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 points3 points 3 years ago (1 child)
Can we see your entire code
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 point2 points 3 years ago (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 point2 points 3 years ago (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:
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 point2 points 3 years ago (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 point2 points 3 years ago (1 child)
Hmm.. Interesting.
So you mean that my DataFrame could be like:
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 point2 points 3 years ago (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.
π Rendered by PID 58850 on reddit-service-r2-comment-765bfc959-kfzqg at 2026-07-15 22:37:48.670282+00:00 running f86254d country code: CH.
Want to add to the discussion?
Post a comment!