This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| # Product ID to generate recommendations for - You could try different product IDs in the data such as A16, C17, P12 etc. | |
| product_id = "A13" | |
| # Get Vector (Embedding) array of the given product | |
| vector_array = np.array(product_ids_and_vectors[product_ids_and_vectors["Product_ID"]==product_id]["Vectors"].tolist()) | |
| # Get cluster number for the given product assigned by the model | |
| cluster_no = model.predict(vector_array)[0] |