TransWikia.com

How to bin Colour values (categorical- high cardinality) to primary colours?

Data Science Asked on January 2, 2021

I have a colour variable with values for different e-commerce products like – olive, teal, blue, green etc.

I want to bin these colours to the primary colour values.

eg –

olive ---> green
teal ----> blue
blue and green will remain the same.

I also have images available of these products, therefore, I am wondering if there is any solution using some clustering technique or using a pre-trained model for classification in some way.

One Answer

Since there are small, finite number of color options, it would be straightforward to manually create a dictionary where the key is the primary color and values are a set of other color values.

In Python, it would be something like:

colors = {"blue": {"blue", "teal"},
          "green": {"green", "olive"},
         }

Answered by Brian Spiering on January 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP