Getting kernel dead error while trying recommendation System with Large matrix

Viewed 24

I have an item-item-based model with collaborative filtering according to the products purchased by the customers. I used the similarity matrix and csr matrix in the model, and the interaction number is like this:

473903 unique customers * 9755 unique Sales Items = 8.196.468 interaction (stored elements in Compressed Sparse Row format)

Then, I aimed to get the following result from the model.

enter image description here

This model is run by apache-spark built on Docker. I tried running it with Jupyter notebook and .py script (from terminal).

.....    
def get_recommendations(data):
    user_label_encoder = LabelEncoder()
    user_ids = user_label_encoder.fit_transform(data.CustomerID)
    product_label_encoder = LabelEncoder()
    product_ids = product_label_encoder.fit_transform(data.ProductId)
    
    similarity_matrix, SalesItemCustomerMatrix = GetItemItemSim(user_ids, product_ids)
    recommendations = get_recommendations_from_similarity(similarity_matrix, SalesItemCustomerMatrix)
    recommendations.index = user_label_encoder.inverse_transform(recommendations.index)
    for i in range(recommendations.shape[1]):
        recommendations.iloc[:, i] = product_label_encoder.inverse_transform(recommendations.iloc[:, i])
    return recommendations

result = get_recommendations(data2)

Jupyter notebook gave kernel dead error. After that, I tried from the terminal. I took this screenshot while experimenting with py script.

enter image description here

After a while, it also gave: a killed error.

Does the model have a way out or am I following the wrong way?

0 Answers
Related