- 29th Jun 2024
- 19:47 pm
In this project, our expert will help you predict advertisement clicks for Company A, providing a comprehensive solution with detailed steps and code examples. Case company A: An advertisement sent by emails from Company A to users who interested in their product. As employee, you need to find a good model to predict if an advertisement will be clicked with given datasets. 3 files user_features.csv - features describing our users product_feature.csv - features describing products shown in the advertisements. click_history.csv - contains which products users had previously seen and whether that user ordered products in this website before.
- Question 1: Data Understanding Explore the basic information of the datasets.
- Question 2: Data Cleaning and Preprocessing Clean and preprocess the datasets (such as missing values, outliers, dummy, merging etc.).
- Question 3: Model Generation and Evaluation (explanation of your modelling approach, why are you choosing to test one model and not another?) Split the data with a ratio of 0.7:0.3 into train and test sets. Build and optimize classification models you learned in this course.
- Question 4: Which model has the best performance? What have you learned from the models you built? (Final evaluation discussing the strengths/weaknesses of your modelling approach)
Case Study: Predicting Advertisement Clicks for Company A - Get Free Solution
Please note that this is a sample Case Study solved by our Python Programmers. These solutions are intended to be used for research and reference purposes only. If you can learn any concepts by going through the reports and code, then our Python Tutors would be very happy.
- Option 1 - To download the complete solution along with Code, Report and screenshots - Please visit our Python Assignment Sample Solution page
- Option 2 - Reach out to our Python Tutors to get online tutoring related to this Case Study and get your doubts cleared
- Option 3 - You can check the partial solution for this assignment in this blog below:
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Classifiers_solution.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "Lv4TQo3iMEFJ"
},
"source": [
"__Importing Basic Libraries:__"
]
},
{
"cell_type": "code",
"metadata": {
"id": "Ep0cuHzcALfi"
},
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import seaborn as sns;sns.set(style=\"white\")\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"import warnings\n",
"warnings.simplefilter(\"ignore\")"
],
"execution_count": 1,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "wrIL3PQLLVYw"
},
"source": [
"__Loading Dataset:__"
]
},
{
"cell_type": "code",
"source": [
"user = pd.read_csv(\"user_features.csv\")\n",
"user.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206
},
"id": "FVbpjSNvPi7j",
"outputId": "2cccdd88-3ed1-4655-b91c-c971f520ac40"
},
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" user_id number_of_clicks_before ordered_before \\\n",
"0 104939 2 True \n",
"1 101562 2 True \n",
"2 102343 2 True \n",
"3 106728 5 True \n",
"4 107179 0 True \n",
"\n",
" personal_interests \n",
"0 ['body', 'makeup', 'nail', 'hand', 'foot', 'me... \n",
"1 ['men_skincare', 'men_fragrance', 'tools', 'sk... \n",
"2 ['tools', 'makeup', 'foot', 'nail'] \n",
"3 ['hand', 'men_skincare'] \n",
"4 ['makeup', 'body', 'skincare', 'foot', 'men_sk... "
],
"text/html": [
"\n",
"
user_id | number_of_clicks_before | ordered_before | personal_interests | |
---|---|---|---|---|
0 | 104939 | 2 | True | ['body', 'makeup', 'nail', 'hand', 'foot', 'me... |
1 | 101562 | 2 | True | ['men_skincare', 'men_fragrance', 'tools', 'sk... |
2 | 102343 | 2 | True | ['tools', 'makeup', 'foot', 'nail'] |
3 | 106728 | 5 | True | ['hand', 'men_skincare'] |
4 | 107179 | 0 | True | ['makeup', 'body', 'skincare', 'foot', 'men_sk... |
\n",
"
\n",
" " title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206
},
"id": "e9RU9l6SP4K-",
"outputId": "92dfc7f0-ad0a-4caf-8b9d-19c90ac468f7"
},
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" user_id product_id clicked\n",
"0 104863 1350 False\n",
"1 108656 1321 True\n",
"2 100120 1110 False\n",
"3 104838 1443 True\n",
"4 107304 1397 True"
],
"text/html": [
"\n",
"
user_id | product_id | clicked | |
---|---|---|---|
0 | 104863 | 1350 | False |
1 | 108656 | 1321 | True |
2 | 100120 | 1110 | False |
3 | 104838 | 1443 | True |
4 | 107304 | 1397 | True |
\n",
"
\n",
" " title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" " width=\"24px\">\n",
\n",
"
\n",
" "
]
},
"metadata": {},
"execution_count": 4
}
]
},
{
"cell_type": "code",
"source": [
"df = pd.merge(click, user, on=\"user_id\")\n",
"df = pd.merge(df, product, on=\"product_id\") \n",
"df = df.drop([\"user_id\", \"product_id\"], axis=1)\n",
"print(\"Our orignal data-set have {} rows and {} columns. \\n\" .format(df.shape[0], df.shape[1]))\n",
"df.head()"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 241
},
"id": "m31xGUgoQFdG",
"outputId": "2af1e022-cb72-4008-fabd-6b9521bc4dc0"
},
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Our orignal data-set have 35990 rows and 8 columns. \n",
"\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
" clicked number_of_clicks_before ordered_before \\\n",
"0 False 2 True \n",
"1 False 2 True \n",
"2 False 2 True \n",
"3 False 4 True \n",
"4 True 1 True \n",
"\n",
" personal_interests category on_sale \\\n",
"0 ['hair', 'body'] nail False \n",
"1 ['men_skincare', 'fragrance', 'hand', 'tools',... nail False \n",
"2 [] nail False \n",
"3 ['fragrance', 'hair', 'foot', 'skincare'] nail False \n",
"4 ['hair', 'nail'] nail False \n",
"\n",
" number_of_reviews avg_review_score \n",
"0 136 2.653361 \n",
"1 136 2.653361 \n",
"2 136 2.653361 \n",
"3 136 2.653361 \n",
"4 136 2.653361 "
],
"text/html": [
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "vApA0vS4SBbO",
"outputId": "25f1ebd6-49b6-45d6-9dcb-7520a37d0323"
},
"execution_count": 6,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\n",
"Int64Index: 35990 entries, 0 to 35989\n",
"Data columns (total 8 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 clicked 35990 non-null bool \n",
" 1 number_of_clicks_before 34425 non-null object \n",
" 2 ordered_before 35990 non-null bool \n",
" 3 personal_interests 35990 non-null object \n",
" 4 category 35990 non-null object \n",
" 5 on_sale 35990 non-null bool \n",
" 6 number_of_reviews 35990 non-null int64 \n",
" 7 avg_review_score 35990 non-null float64\n",
"dtypes: bool(3), float64(1), int64(1), object(3)\n",
"memory usage: 1.8+ MB\n"
]
}
This is a partial solution. If you need access to the complete work, please contact us via email or live chat.
Get the best Case Study: Predicting Advertisement Clicks for Company A - Free Solution help and tutoring services from our experts now!
About The Author - Ross Gem
Ross Gem, a seasoned Data Scientist with extensive experience in predictive modeling and analytics, will guide you through this case study. Ross specializes in leveraging machine learning techniques to uncover actionable insights from complex datasets. With Ross's guidance, you'll learn how to preprocess data, build and evaluate models, and interpret the results to make data-driven decisions.