# Technique/Algorithm for product categorization Machine Learning

I am going in a very abstract layer for the problem, but I think this problem might be a common one so posting it.

So, what I am looking for is any ML algorithm or Data Science technique is there to create a relationship factor between different sets of goods.

I guess, its used heavily in social media, but here I am talking w.r.t. product goods context. Like suppose if we sell a bunch of products together in a store, so in collection there will be many products that are always bought together.

So, accordingly there will be a relationship factor between different products i.e. some product that are always bought together will have a higher factor than the one that are bought together less frequently.

So, is there any approach where we can tackle this problem to get the factor between two products using any technique?

Edit : Narrowing it down to a universe where all items are having same factors and their relationship factor to each other totally depends on their occurance together.

• This sounds like a frequent item set / association rule problem, or a recommender system. That's a lot of territory, so I think you'd have to narrow down from there what you are asking. Aug 30 '17 at 12:08

I assume you are looking for a similarity measure between items. A quick and simple one is item-item cosine similarity. An item (product) can be represented by a vector $x$ with $x_i = 1$ if it was in the $i$th purchase, otherwise $x_i=0$. The similarity between two products is then
$$\frac {<x,y>} {\lVert x \rVert \lVert y \rVert} = \frac{x_1y_1 + \dots + x_n y_n} {\sqrt{\sum x_i^2 \sum y_i^2} } = \frac {\mbox{number of times 1 & 2 sold together}} {\sqrt{\mbox{number of times 1 sold} \times \mbox{ number of times 2 sold} }}$$
{"ft_lang_label":"__label__en","ft_lang_prob":0.9664659,"math_prob":0.97224545,"size":995,"snap":"2021-31-2021-39","text_gpt3_token_len":196,"char_repetition_ratio":0.12512614,"word_repetition_ratio":0.0116959065,"special_character_ratio":0.19497487,"punctuation_ratio":0.10152284,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99628067,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-27T22:45:30Z\",\"WARC-Record-ID\":\"<urn:uuid:b46ff972-0022-4d46-9167-a5b95ba410f2>\",\"Content-Length\":\"178510\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ac85fe25-4317-4728-8249-df8c360f6f53>\",\"WARC-Concurrent-To\":\"<urn:uuid:d47ae8c9-1998-4fe0-828f-8181bbad01a9>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://datascience.stackexchange.com/questions/22709/technique-algorithm-for-product-categorization-machine-learning\",\"WARC-Payload-Digest\":\"sha1:WRTRMKJCLD7JYT55FL4DTLM54HCILUWJ\",\"WARC-Block-Digest\":\"sha1:Q4E4UWV5FZBK2V625D4JYQOFPW2ULEDI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780058552.54_warc_CC-MAIN-20210927211955-20210928001955-00197.warc.gz\"}"}