You are on page 1of 15

MINISTRY OF EDUCATION AND

TRAINING
THE SAIGON INTERNATIONAL
UNIVERSITY

FINAL EXAM PROJECT


ARTIFICIAL INTELLIGENCE COURSE

TOPIC:RECOMMENDER SYSTEM
MAJOR: SOFTWARE ENGINEERING

LECTURER:
DR. TRAN QUANG HUY
STUDENTS:
DOAN QUOC HUY - 8102202517
BACH XUAN CANH - 81012202528

HCM City - 11, 2023


CONTENTS

I. Introduction............................................................................3
II. About the dataset..................................................................5
III. Overview of the System......................................................9
IV. The operation of the system...............................................9
V. Project..................................................................................10
1. Importing Libraries:........................................................10
2. Reading Data:...................................................................10
3. Reading Customer Names and Product Names from
Text File:................................................................................11
4. Defining the load_name Function:.................................11
5. Calculating and Returning Customer Information:......13
6. Defining the Predict Function:........................................14
7. Execution:..........................................................................15

2
I. Introduction

Nowadays, Artificial Intelligence (AI) and Machine Learning have evolved


beyond being merely captivating topics; they have become pivotal fields
shaping various facets of life and business. These disciplines not only serve as
a source of inspiration but also act as powerful drivers behind innovation and
progress in today's society.

In this article, we will delve into a significant domain of AI—Recommender


Systems. Recommender Systems are not just intriguing; they play a crucial role
in enhancing user experiences and optimizing business performance. This is
achieved through their capability to predict and suggest personalized content
based on individual behaviors and preferences.

We can leverage the power of Recommender Systems across diverse sectors


such as e-commerce, online entertainment, and education to provide the best
possible ex.

The Essence of Recommender Systems:


Recommender Systems, often referred to as recommendation engines, are AI
applications designed to analyze user preferences and behaviors, providing
personalized suggestions and predictions. These systems utilize advanced
algorithms and machine learning techniques to understand patterns in user data,
making them a cornerstone in today's data-driven decision-making landscape.

Unleashing Potential in E-Commerce:


In the realm of e-commerce, Recommender Systems act as digital personal
shoppers, guiding users through a vast array of products to discover items
tailored to their tastes. These systems analyze purchase histories, browsing
habits, and demographic information to recommend products that align with
individual preferences. The result? Enhanced user engagement, increased
customer satisfaction, and a substantial boost in sales.

Moreover, by incorporating real-time data and feedback loops, e-commerce


platforms can continually refine their recommendations, ensuring that users are
exposed to the latest and most relevant offerings. This dynamic adaptability
creates a personalized shopping journey that keeps users coming back for more.

Transforming Entertainment Experiences:


3
The influence of Recommender Systems extends seamlessly into the realm of
online entertainment, shaping how users discover and consume content.
Streaming platforms leverage these systems to curate personalized playlists,
recommend movies or TV shows based on viewing history, and even predict
genres or artists users might enjoy.

This not only caters to individual preferences but also introduces users to a
diverse range of content they might not have discovered on their own. The
marriage of AI and entertainment transforms passive viewership into an
interactive and engaging experience, fostering a deeper connection between
users and the platform.

Personalized Learning in Education:


In the educational sector, Recommender Systems are reshaping the way
students access and interact with learning materials. These systems analyze
learning patterns, performance metrics, and individual preferences to
recommend customized study materials, courses, or supplementary resources.

By tailoring educational content to the unique needs of each learner,


Recommender Systems contribute to more effective and personalized learning
experiences. Students can explore topics at their own pace, receive targeted
assistance, and discover additional resources that align with their learning
objectives.

Overcoming Challenges and Ethical Considerations:


While the potential of Recommender Systems is immense, it's essential to
address challenges such as algorithmic biases and privacy concerns. Striking a
balance between personalization and respecting user privacy is crucial to
building trust and ensuring responsible AI implementation.

Conclusion:
In conclusion, Recommender Systems are not just technological innovations;
they represent a paradigm shift in how businesses engage with users and how
individuals interact with digital platforms. As these systems continue to evolve,
striking the right balance between personalization, ethics, and user satisfaction
will be key to unlocking their full potential across diverse sectors. Embracing
the power of AI-driven recommendations is not just a choice; it's a strategic
imperative in today's competitive and dynamic landscape.

4
II. About the dataset

Regarding the dataset, we obtained it from a website of a store specializing in


smart devices. It comprises over 40 models of various smart devices that we
utilized as the data for this project.

File DSSP.csv

Next is the MAHOA.csv file that we encrypted to execute the model, and for
example some customers we also encrypted.

5
File MAHOA.csv

Next is the DATA.csv file that we encode into vectors

6
File DATA.csv

Next is the test.csv file, which we also encode into vectors like the DATA.csv
file and here are some data collected to test the model.

7
File test.csv

8
III. Overview of the System

Product Recommendation Systems: Elevating User Experience through


Technological Sophistication
Product recommendation systems transcend the realm of ordinary information
technology; they are wellsprings of inspiration and catalysts for innovation
and progress in contemporary society. At their essence, these systems
function as intelligent digital assistants, strategically enhancing user
experiences and propelling business performance.

Inception Point:
Product recommendation systems represent intricate orchestrations of
algorithms and machine learning, delving into the nuances of user data to
furnish personalized recommendations for products, services, or content.
They are not merely technological tools but rather intelligent, informed
companions embarking on the journey of exploration and discovery.

Broad Application:
The impact of recommendation systems extends far beyond online shopping,
permeating various sectors such as online entertainment, travel, education,
and even social networks. From crafting personalized playlists on streaming
platforms to suggesting tailored learning content, recommendation systems
redefine the dynamics of our interactions with the digital landscape.

Optimizing User Experience:


In the realm of online shopping, recommendation systems metamorphose
websites into dynamic e-commerce spaces, where each user click on a product
becomes an opportunity to explore novel options. By scrutinizing shopping
history and browsing patterns, these systems contribute to the optimization of
user experiences, fostering increased satisfaction and, notably, driving up
sales.

IV. The operation of the system

The recommendation system operates based on data analysis and the


application of intelligent algorithms. By identifying correlations
between user data and content, the system can generate accurate and
relevant suggestions. This process involves collecting, processing, and

9
categorizing data, then providing personalized recommendations for
users.

Step 1: Data collection


The recommendation system gathers data from various sources such
as search history, user behavior, and personal information.

Step 2: Data processing


The collected data will undergo further processing to identify patterns
and significant trends

Step 3: Generating recommendations


Data analysis algorithms will be applied to generate personalized
recommendations for each user.

V. Project

1. Importing Libraries:

This imports the pandas library and assigns it the alias pd.

2. Reading Data:

In this phase, the project reads and loads the relevant dataset. This dataset
likely contains information about customer behaviors, preferences, and
interactions with various products. Proper data preprocessing techniques may
be applied at this stage.
Reading Customer Names and Product Names from Text File:

It reads data from two CSV files (DATA.csv and test.csv) into pandas
DataFrames (movies and movies_test).

10
3. Reading Customer Names and Product Names from Text
File:

This step ensures that the system recognizes and adapts to individual
preferences and product catalog updates.

It opens a text file (Name.xstx.txt) and reads customer names (Ten_kh)


and product names (Ten_sp) using the load_name function.

4. Defining the load_name Function:

The load_name function is crucial for handling the extraction of customer


names and product names. This function likely plays a key role in associating
customer identities with their respective preferences and purchase history.

11
 Read the first line from the text file (X = name.readline()):
- The data in this line (assumed to be customer names) is processed to separate
customer names.
- If encountering a ',' or ']', it will add the constructed name to the list and reset
the variable 'ten' to start building a new name.
- If it is not a separator or newline character, it will add the character to the
'ten' variable.

 Read the second line from the text file (X = name.readline()):


- This line (assumed to be product names) is processed similarly to the previous
line to separate product names.

 Return the lists of customer names and product names (return ten_kh,
ten_sp):
- The function returns two constructed lists, one containing customer names
and the other containing product names.

After executing the load_name function, we receive the following result:

12
5. Calculating and Returning Customer Information:

 Find the ID of the customer in the list Ten_kh:


- Iterate through the list Ten_kh to determine the position (index) of the
customer with the ID ID_chu in the list.
- Save that position into the variable ID_c.

 Collect information about the customer's purchase times:


- Iterate through the list Ten_kh again to find the rows in the DataFrame
movies (assuming it contains purchase data) corresponding to the customer
with the ID ID_c.
- If found, identify the customer's purchase times from the 'Thời gian' (time)
column and save them to the list gio. It seems that time is represented as a
string and is separated by ':', then converted to an integer.

 Compute the number of purchases at the same time for other


customers:
- Iterate through the list Ten_kh again to check each customer.

13
- If the customer is not the one currently examined (different from ID_chu),
check if they made purchases at the same time as any of the times bought by
the currently examined customer.
- If yes, increase the value of the variable count[i] by 1.

 Identify the customer with the most purchases:


- Iterate through the list Ten_kh to find the customer with the highest number
of purchases.
- Save information about the name and index of this customer into the variables
Ten_kh[index], index.

 Return information about the customer with the most purchases:


- The function returns the name and index of the customer with the highest
number of purchases.

6. Defining the Predict Function:

 Invoke the load_data function to determine information related to the


customer Name:
- Call the load_data(Name) function to retrieve information about the
customer's name and index in the list Ten_kh.
- Save this information in the variables Name_Same and Index.
 Iterate through the test dataset (movies_test) to identify the products
that the customer has purchased:
- Use a loop to iterate through each row in the movies_test DataFrame.
- If the index of the customer (Index) matches the information about the
customer's name in the test set, add the purchased product ('Sản phẩm mua') to
the list Ds_sp.
 Build the list of recommended products (SP):
- Iterate through the Ds_sp list (products already purchased) and check whether
the corresponding product in the Ten_sp list has been added to the SP list.

14
- If not, add it to the SP list.
 Print out the list of recommended products:
- Use the print command to display on the screen the list of recommended
products (SP).

7. Execution:

The script then executes by calling the Predict function with a specified
customer name.

Here are some of the obtained results.

15

You might also like