I am trying to find the best solution to create a "model" and presentation of the following challenge:
I have several products which shall be bought from as few suppliers as possible. For each product I have several supplier options.
My data look something like this:
I am now trying to do two things:
- Find a way to cluster my products at as few suppliers as possible, and
- a graphical presentation of 1.
My first attempt was to transform the data encoding to "hot-one" encoding with the following code:
require(tidyr) test.df <- gather(data.Jan20, "Supplier", "Name", 7:14) library(mltools) library(data.table) dmy <- as.data.table(test.df) dmy <- dmy[,c("Name","Product")] dmy <- one_hot(dmy, cols = "auto", dropCols = TRUE, dropUnusedLevels = TRUE,sparsifyNAs = TRUE ) head(dmy)
I think this leads me in the right direction, however I am stuck on how to optimize and present the results now.
Any advise to this practical question would be greatly appreciated.