lyst / lightfm

A Python implementation of LightFM, a hybrid recommendation algorithm.
Apache License 2.0
4.66k stars 679 forks source link

Recommendation model with text embedding as item feature #713

Open robin495 opened 1 week ago

robin495 commented 1 week ago

Hi!

I'm trying to build a model with text embeddings from books as one input parameter along with reading history.

I have done text analysis to get fixed sized embeddings representing each books content. I have a 1x150 dimensional vector with the text embeddings. Is it correct to build the item feature data that is feeded into the dataset.build_item_features on the following format: [item_id:{feature0:embeddingvector[0],feature1:embeddingvector[1]} .. etc]?

Like this example:

embedding_vector = [1,2,1,0]

item_data_test = [['item_id1',{'feature_0':1,'feature_1':2,'feature_2':1,'feature_3':0}]]

item_features_test = dataset.build_item_features(item_data_test, normalize=True)

Thanks, Robin