Oh NLP with Python

Building a Product Recommendation System for E-Commerce: Part II — Model Building

How I build a product recommendation system using python

Image for post
Image for post
Photo by Campaign Creators on Unsplash

Exploratory Data Analysis

Image for post
Image for post
Visualization Created Using SQL on ScoreFast Platform (by Author)
Image for post
Image for post
Visualization Created Using SQL on ScoreFast Platform (by Author)
Image for post
Image for post
Visualization Created Using SQL on ScoreFast Platform (by Author)
Image for post
Image for post
Visualization Created Using SQL on ScoreFast Platform (by Author)
Image for post
Image for post
Visualization Created Using SQL on ScoreFast Platform (by Author)
Image for post
Image for post
Visualization Created Using SQL on ScoreFast Platform (by Author)

Text Vectorization

Image for post
Image for post
Visualization of Word Embedding Vectors using Gensim and PCA (by Author)

Build a KNN model

indices = pd.Series(combined_df.product)#Build a KNN model
model = NearestNeighbors(n_neighbors=100,n_jobs=-1)
knn = model.fit(combined_df_drop_product)
def predict(name):dress_index = (combined_df[combined_df['product']==name]).index.tolist()
dress_index = dress_index[0]
distances, indices = knn.kneighbors(combined_df_drop_product.iloc[[dress_index],:])index = indices[0]
distance = distances[0]
nearest_list = []

for k in range(0,len(index)):
dress_name = combined_df.iloc[index[k],0]
if dress_name not in nearest_list:
nearest_list.append(dress_name)
return nearest_list[1:]
Image for post
Image for post
Patagonia Alpine Valley Dress’s Recommended Products from the site V.S the Model Prediction (by Author)

Product Reviews Sentiment Analysis

positive sentiment : (compound score >= 0.05)
neutral sentiment : (compound score > -0.05) and (compound score < 0.05)
negative sentiment : (compound score <= -0.05)

Image for post
Image for post
Visualization Created automatically on ScoreFast Platform (by Author)

☁️WordCloud Rating Group for all product

Image for post
Image for post
WordCloud Generated by Author

☁️WordCloud Rating Group for all product

Image for post
Image for post
WordCloud Generated by Author

Summary

Review Rating Prediction

Image for post
Image for post
Built regression models on ScoreFast™ (by Author)
Image for post
Image for post
Correlation between review rating and its compound score (by Author)

Final Thought

Acknowledgment

Reference

Written by

I’m passionate about the possibilities that Data Science can enable. I write about what I’ve learned. Never stop learning because life never stops teaching.❤️

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store