Building a Recommender System  Using data captured by a *Customer Relationship Management system(CRM)
Source: thedatascientist.com

Building a Recommender System Using data captured by a *Customer Relationship Management system(CRM)

Note: *The data has been simulated using the pandas series instead of an actual CRM

A CRM, or Customer Relationship Management system, is an essential tool for businesses to efficiently manage and nurture their relationships with their customers. This powerful system centralizes all customer information, including their contact details, purchase history, preferences, and interactions with the business, allowing businesses to better understand their customers and send personalized messages tailored to their interests and needs.

With this system in place, businesses can provide quicker and more effective customer service, enabling teams to quickly access customer information and provide prompt assistance. The sales and marketing teams can work together to identify potential customers and provide a seamless sales process.

The code below depicts a simple yet efficient recommender system that can be trained using data obtained from a common CRM. This system can be improved and adapted into an application that can be integrated into a business e-commerce portal. Ultimately, this will aid customers by offering them more efficient recommendations.

Before developing the recommender system, some data was generated using the pandas series to simulate real data and Exploratory data analytics has been performed. Although performing EDA before building the recommender system is important, it is beyond the scope of this article which focuses solely on building the recommender system.

Note: *The data has been simulated using the pandas series


Interest in different types of Property
The purpose of a heatmap in Exploratory Data Analysis (EDA) is to visually represent and explore the relationships and patterns within a dataset..


A clear and concise summary of the data, allows you to identify patterns, central tendencies, variability, and the presence of outliers.


Code for a simple recommender system
import pandas as pd
from surprise import Reader, Dataset
from surprise import SVD
from surprise.model_selection import train_test_split        

The code below is a typical recommender system used to recommend properties for potential clients


# Load your dataset
data = pd.read_csv('your_dataset.csv')  # Replace 'your_dataset.csv' with your dataset file

# Define the Reader object for the dataset
reader = Reader(rating_scale=(0, 5))  # Assuming ratings are on a scale from 0 to 5

# Create a Surprise Dataset
data = Dataset.load_from_df(data[['Client_ID', 'Property_ID', 'Rating']], reader)

# Split the data into train and test sets
trainset, testset = train_test_split(data, test_size=0.2)

# Create and train the collaborative filtering model (SVD)
model = SVD(n_factors=100, n_epochs=20, verbose=True)
model.fit(trainset)
        

Making predictions using the ML model


# Make predictions
predictions = model.test(testset)

# Recommend properties for a specific client
client_id = 1  # Replace with the desired client ID
client_properties = data[data['Client_ID'] == client_id]['Property_ID']
properties_to_predict = data['Property_ID'].unique()
properties_to_predict = [p for p in properties_to_predict if p not in client_properties]

# Predict ratings for the properties the client hasn't interacted with yet
predictions_for_client = [model.predict(client_id, property_id) for property_id in properties_to_predict]

# Sort the recommendations by predicted rating in descending order
recommendations = sorted(predictions_for_client, key=lambda x: x.est, reverse=True)

# Get the top N recommended properties
top_n = 10  # Number of top recommendations to provide
recommended_property_ids = [int(recommendation.iid) for recommendation in recommendations[:top_n]]

# You can now display the recommended property IDs to the client
print("Recommended Property IDs for Client", client_id, ":", recommended_property_ids)
        

By adding a Recommender System to the CRM, businesses can significantly increase their sales by analyzing past customer behavior and suggesting personalized product recommendations. Customers are more likely to make a purchase when they see recommendations that match their interests, leading to increased sales, repeat purchases, and customer loyalty.

要查看或添加评论,请登录

Dr. Heman Mohabeer的更多文章

社区洞察

其他会员也浏览了