img-link : https://www.smartinsights.com/digital-marketing-strategy/online-retail-sales-growth/
Terdapat peningkatan yang signifikan dalam volume penjualan E-commerce sejak dimulainya pandemi COVID-19 (Smart Insights, 2023). Fenomena ini tidak hanya bersifat sementara, melainkan diprediksi akan terus meningkat ke depannya. Untuk memanfaatkan peluang ini, dibutuhkannya untuk merancang dan mengimplementasikan sistem atau metode inovatif yang dapat memberikan keuntungan kompetitif bagi E-commerce. Selain fokus pada aspek finansial, strategi ini juga harus difokuskan pada meningkatkan pengalaman pelanggan, menciptakan nilai tambah, dan menarik perhatian pelanggan baru. Dengan pendekatan seperti ini, E-commerce dapat memaksimalkan potensi pertumbuhan dan kesuksesan jangka panjang.
img-link : https://www.cleartouch.in/wp-content/uploads/2023/02/Customer-Segmentation.png
Customer Segmentation, seperti yang dikemukakan oleh Zohuri et al. (2022), adalah sebuah metode yang terfokus pada pembagian basis pelanggan menjadi kelompok individu dengan atribut serupa. Metode pemasaran ini menjadi krusial dalam upaya mencapai hasil optimal dan melancarkan operasional bisnis. Dalam konteks ini, pemahaman mendalam terhadap pendekatan yang paling efektif untuk segmen target tertentu menjadi suatu keharusan, sebagaimana diungkapkan oleh Geršak (2013), bersama dengan identifikasi kebutuhan, keinginan, dan harapan dari segmen pelanggan yang spesifik. Integrasi produk dan komunikasi dengan memperhatikan faktor-faktor ini membawa konsekuensi positif berupa peningkatan kepuasan pelanggan dan sekaligus membuka pintu bagi identifikasi peluang strategis.
Dengan mengimplementasikan sistem customer segmentation. Maka sebuah E-commerce dapat lebih baik memprediksi keinginan pelanggan dan juga lebih mengenali fitur-fitur yang telah diimplementasikan sebelumnya dan cara memanfaatkannya lebih baik. Dengan ini, akan membuka peluang baru yang sebelumnya tidak tereksplor untuk memberi dampak positif bagi kedua belah pihak.
link: https://www.kaggle.com/datasets/swathiunnikrishnan/amazon-consumer-behaviour-dataset
# Read data csv
amazon <- read.csv("Amazon Customer Behavior Survey.csv")
# Load libraries for unsupervised machine learning
library(dplyr) # Data manipulation used for preprocessing and cleaning data##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.3.2
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(FactoMineR) # Multivariate exploratory data analysis used for extracting patterns and relationships
library(animation) # Creating animated visualizations used for dynamic data exploration
library(tidyr) # Tidying and reshaping data used for preparing data for analysis
library(ggiraphExtra) # Interactive plots using ggplot2 used for exploring and identifying insights interactively
library(gridExtra) # Creating multiple plots in a single command##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
## Warning: package 'stringr' was built under R version 4.3.2
## Warning: package 'purrr' was built under R version 4.3.2
## Warning: package 'tidyverse' was built under R version 4.3.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ tibble 3.2.1
## ✔ readr 2.1.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ gridExtra::combine() masks dplyr::combine()
## ✖ plotly::filter() masks dplyr::filter(), stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## [conflicted] Will prefer dplyr::filter over any other package.
age= agegender= genderPurchase_Frequency= How frequently do you make
purchases on Amazon?Purchase_Categories= What product categories do you
typically purchase on Amazon?Personalized_Recommendation_Frequency = Have you ever
made a purchase based on personalized product recommendations from
Amazon?Browsing_Frequency =How often do you browse Amazon’s
website or app?Product_Search_Method =How do you search for products
on Amazon?Search_Result_Exploration =Do you tend to explore
multiple pages of search results or focus on the first page?Customer_Reviews_Importance =How important are customer
reviews in your decision-making process?Add_to_Cart_Browsing =Do you add products to your cart
while browsing on Amazon?Cart_Completion_Frequency =How often do you complete
the purchase after adding products to your cart?Cart_Abandonment_Factors =What factors influence your
decision to abandon a purchase in your cart?Saveforlater_Frequency =Do you use Amazon’s “Save for
Later” feature, and if so, how often?Review_Left =Have you ever left a product review on
Amazon?Review_Reliability =How much do you rely on product
reviews when making a purchase?Review_Helpfulness =Do you find helpful information
from other customers’ reviews?Personalized_Recommendation_Frequency =How often do you
receive personalized product recommendations from Amazon?Recommendation_Helpfulness =Do you find the
recommendations helpful?Rating_Accuracy =How would you rate the relevance and
accuracy of the recommendations you receiveShopping_Satisfaction =How satisfied are you with your
overall shopping experience on Amazon?Service_Appreciation =What aspects of Amazon’s services
do you appreciate the most?Improvement_Areas =Are there any areas where you think
Amazon can improve?Data ini merupakan data kustomer pengguna Amazon dan aktivitas yang mereka lakukan di situs web tersebut. Sumber data berasal dari Kaggle dan terdiri dari 23 kolom dan 604 baris, yang merupakan hasil isian melalui Google Form. Data ini memberikan rincian seperti kategori pembelian, frekuensi pembelian, dan lainnya dalam total 24 kolom. Informasi ini dapat memberikan akurasi yang diperlukan untuk melakukan Customer Segmentation.
Objektif: - Target = Customer
Segmentation / Customer Grouping of Amazon Customers -
Predictors = Columns
## [1] 0
## Timestamp age
## 0 0
## Gender Purchase_Frequency
## 0 0
## Purchase_Categories Personalized_Recommendation_Frequency
## 0 0
## Browsing_Frequency Product_Search_Method
## 0 0
## Search_Result_Exploration Customer_Reviews_Importance
## 0 0
## Add_to_Cart_Browsing Cart_Completion_Frequency
## 0 0
## Cart_Abandonment_Factors Saveforlater_Frequency
## 0 0
## Review_Left Review_Reliability
## 0 0
## Review_Helpfulness Personalized_Recommendation_Frequency.1
## 0 0
## Recommendation_Helpfulness Rating_Accuracy
## 0 0
## Shopping_Satisfaction Service_Appreciation
## 0 0
## Improvement_Areas
## 0
## [1] "Yes" "Maybe" "No"
## [1] "Sometimes" "Often" "Rarely" "Never" "Always"
## [1] "Found a better price elsewhere"
## [2] "High shipping costs"
## [3] "Changed my mind or no longer need the item"
## [4] "others"
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.00 23.00 26.00 30.79 36.00 67.00
Ditemukannya Umur outlier pada data yaitu 3 tahun, oleh karena itu, data ini perlu dihapus.
# Mengsubset data outlier
amazon <- subset(amazon, age >= 13) # Minimal penggunaan amazon yaitu berumur 13 tahun# Konversi kolom
amazon <- amazon %>%
mutate_at(
vars(c(3:4,6:9,11:17,19,22:23)), # Mutating character into factor
as.factor
) %>%
mutate(Timestamp = ymd_hms(str_replace(Timestamp, " GMT[+-]\\d{1,2}:\\d{2}", ""), tz = "GMT")) # Mutating character into time# Pembuatan kolom baru
# 1. Rata-rata kolom-kolom dbl
amazon$Overall_Satisfaction <- ((amazon$Rating_Accuracy + amazon$Personalized_Recommendation_Frequency.1 + amazon$Shopping_Satisfaction) /3)
# 2. Multiple_Categories (pembelian lebih dari satu kategori)
amazon <- amazon %>%
mutate(Multiple_Categories = ifelse(grepl(";", Purchase_Categories), "Multiple Items", "Single Item")) %>%
mutate(Multiple_Categories = as.factor(Multiple_Categories))Next, we will split Purchase_Categories column into several parts according to its uniques.
## [1] "Beauty and Personal Care"
## [2] "Clothing and Fashion"
## [3] "Groceries and Gourmet Food;Clothing and Fashion"
## [4] "Beauty and Personal Care;Clothing and Fashion;others"
## [5] "Beauty and Personal Care;Clothing and Fashion"
## [6] "Beauty and Personal Care;Clothing and Fashion;Home and Kitchen"
## [7] "Clothing and Fashion;Home and Kitchen"
## [8] "others"
## [9] "Clothing and Fashion;others"
## [10] "Beauty and Personal Care;Home and Kitchen"
## [11] "Groceries and Gourmet Food"
## [12] "Groceries and Gourmet Food;Clothing and Fashion;others"
## [13] "Groceries and Gourmet Food;Beauty and Personal Care;Clothing and Fashion;Home and Kitchen"
## [14] "Groceries and Gourmet Food;Beauty and Personal Care;Clothing and Fashion;Home and Kitchen;others"
## [15] "Home and Kitchen"
## [16] "Beauty and Personal Care;others"
## [17] "Beauty and Personal Care;Home and Kitchen;others"
## [18] "Home and Kitchen;others"
## [19] "Groceries and Gourmet Food;Home and Kitchen"
## [20] "Beauty and Personal Care;Clothing and Fashion;Home and Kitchen;others"
## [21] "Groceries and Gourmet Food;Beauty and Personal Care;Home and Kitchen"
## [22] "Groceries and Gourmet Food;Home and Kitchen;others"
## [23] "Groceries and Gourmet Food;Clothing and Fashion;Home and Kitchen;others"
## [24] "Groceries and Gourmet Food;Beauty and Personal Care"
## [25] "Clothing and Fashion;Home and Kitchen;others"
## [26] "Groceries and Gourmet Food;Beauty and Personal Care;Clothing and Fashion"
## [27] "Groceries and Gourmet Food;Clothing and Fashion;Home and Kitchen"
## [28] "Groceries and Gourmet Food;Beauty and Personal Care;others"
## [29] "Groceries and Gourmet Food;Beauty and Personal Care;Clothing and Fashion;others"
According to this data, there are several categories available at
amazon, they are : -
Beauty and Personal Care -
Clothing and Fashion -
Groceries and Gourmet Food - Home and Kitchen
- others
# Pemecahan Purchase_Categories
amazon_a <- amazon %>%
mutate(Objects = strsplit(Purchase_Categories, ";", fixed = TRUE)) %>%
rowwise() %>%
mutate(Beauty_and_Personal_Care = ifelse("Beauty and Personal Care" %in% Purchase_Categories, 1, 0),
Clothing_and_Fashion = ifelse("Clothing and Fashion" %in% Purchase_Categories, 1, 0),
Groceries_and_Gourmet_Food = ifelse("Groceries and Gourmet Food" %in% Purchase_Categories, 1, 0),
Home_and_Kitchen = ifelse("Home and Kitchen" %in% Purchase_Categories, 1, 0),
others = ifelse("others" %in% Purchase_Categories, 1, 0)) %>%
select(-Purchase_Categories, - Objects)## [1] Competitive prices Wide product selection
## [3] User-friendly website/app interface .
## [5] Customer service Product recommendations
## [7] Customer service Quick delivery
## [9] All the above
## 9 Levels: . All the above Competitive prices ... Wide product selection
## [1] Reducing packaging waste
## [2] Product quality and accuracy
## [3] Shipping speed and reliability
## [4] Customer service responsiveness
## [5] Nothing
## [6] better app interface and lower shipping charges
## [7] Nil
## [8] Add more familiar brands to the list
## [9] UI
## [10] Scrolling option would be much better than going to next page
## [11] Quality of product is very poor according to the big offers
## [12] I have no problem with Amazon yet. But others tell me about the refund issues
## [13] User interface
## [14] Irrelevant product suggestions
## [15] User interface of app
## [16] I don't have any problem with Amazon
## [17] No problems with Amazon
## 18 Levels: . ... User interface of app
amazon_sep <- amazon_sep[-280, ] # Menghapus row yang Mengandung varian "User interface" karena terdapat error dalam mutasi penamaanDitemukan beberapa varian yang memiliki arti sama :
Nothing
- Nothing
- Nil
- I don’t have any problem with Amazon
- No problems with Amazon
# Penamaan kembali varian dari Improvement_Areas (Nothing)
amazon_sep <- amazon_sep %>%
mutate(
Improvement_Areas = recode(Improvement_Areas, "Nil" = "Nothing"),
Improvement_Areas = recode(Improvement_Areas, "I don't have any problem with Amazon" = "Nothing"),
Improvement_Areas = recode(Improvement_Areas, "No problems with Amazon" = "Nothing"))UI
- UI
- User Interface
- Scrolling option would be much better than going to next page
- User interface of app
# Penamaan kembali varian dari Improvement_Areas (UI)
amazon_sep <- amazon_sep %>%
mutate(Improvement_Areas = recode(Improvement_Areas, "UI" = "User interface"),
Improvement_Areas = recode(Improvement_Areas, "Scrolling option would be much better than going to next page" = "User interface"),
Improvement_Areas = recode(Improvement_Areas, "User interface of app" = "User interface"))## Warning in ggcorr(amazon_sep, label = T, hjust = 1): data in column(s)
## 'Timestamp', 'Gender', 'Purchase_Frequency',
## 'Personalized_Recommendation_Frequency', 'Browsing_Frequency',
## 'Product_Search_Method', 'Search_Result_Exploration', 'Add_to_Cart_Browsing',
## 'Cart_Completion_Frequency', 'Cart_Abandonment_Factors',
## 'Saveforlater_Frequency', 'Review_Left', 'Review_Reliability',
## 'Review_Helpfulness', 'Recommendation_Helpfulness', 'Service_Appreciation',
## 'Improvement_Areas', 'Multiple_Categories' are not numeric and were ignored
Dari plot korelasi, dapat ditemukan hanya beberapa kolom yang saling
memiliki korelasi yaitu Overall_Satisfaction,
Shopping_Satisfaction, Rating_Accuracy,
Customer_Reviews_Importance, dan
Personalized Recommendation_Frequency.1 (karena merupakan
hasil jumlah gabungan antar kolom). Selain itu, kolom-kolom hanya
memiliki korelasi bernilai -0.1 hingga 0.1.
# Plot Waktu Pembelian - 24 Jam
amazon_sep%>%
mutate(hour = hour(Timestamp))%>%
ggplot() +
geom_bar(aes(x = hour), fill = "orange") +
scale_x_continuous(breaks = seq(1,24)) +
labs(title = "Waktu Pembelian", subtitle = "dalam sehari",
x = "Hour",
y = NULL) +
theme_minimal()Dari plot di atas, dapat disimpulkan bahwa mayoritas pembelian dilakukan pada sore hingga malam hari dan peak hour terjadi pada jam 17.
# Plot Waktu Pembelian Perminggu
amazon_sep %>%
mutate(wday = factor(weekdays(Timestamp), levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>%
ggplot() +
geom_bar(aes(x = wday), stat = "count", fill = "orange") +
geom_text(stat = "count", aes(x = wday, label = after_stat(count)), vjust = -0.5) +
labs(title = "Waktu Pembelian", subtitle = "dalam seminggu", x = NULL, y = NULL) +
theme_minimal()Dari data di atas, dapat dilihat bahwa pembelian paling sering terjadi pada hari Kamis dengan total transaksi sebanyak 119 kali, diikuti oleh hari Rabu dengan total transaksi sebanyak 111 kali. Walaupun begitu, hanya terjadi 4 transaksi terjadi pada hari Sabtu.
# Plot Waktu Pembelian Perminggu - 24 Jam
amazon_sep %>%
mutate(hour = hour(Timestamp),
wday = weekdays(Timestamp)) %>%
ggplot() +
geom_bar(aes(x = hour), fill = "orange") +
scale_x_continuous(breaks = seq(1, 24)) +
labs(title = "Waktu Pembelian", subtitle = "dalam seminggu",
x = NULL,
y = NULL) +
theme_minimal() +
facet_wrap(~wday, scales = "free_x", ncol = 2) +
theme(strip.text.x = element_text(size = 8))Plot di atas menunjukkan
amazon_sep %>%
ggplot() +
geom_bar(aes(x = age), fill = "orange") +
scale_x_continuous() +
labs(title = "Umur Pelanggan",
x = "Umur",
y = NULL) +
theme_minimal()Berdasarkan plot yang disajikan, terlihat bahwa sebagian besar pelanggan Amazon memiliki rentang usia sekitar 23 tahun, dan pelanggan termuda berusia 15 tahun. Dapat disimpulkan bahwa rentang umur pelanggan, seperti yang terlihat dari plot, berkisar antara 15 hingga 45 tahun.
amazon_sep %>%
ggplot() +
geom_bar(aes(x = Gender), fill = "orange") +
geom_text(stat = "count", aes(x = Gender, label = after_stat(count)), vjust = -0.5) +
labs(title = "Gender pelanggan", subtitle = "Amazon",
x = NULL,
y = NULL) +
theme_minimal()Dapat di lihat dari plot di atas bahwa mayoritas pelanggan Amazon merupakan perempuan dengan angka mencapai 351, diikuti oleh laki-laki dengan angka 140. Namun, di posisi terakhir terdapat pelanggan yang tidak mengklaim sebagai laki-laki maupun perempuan dengan angka 19.
separate_rows(amazon, Purchase_Categories, sep = ";") %>%
ggplot() +
geom_bar(aes(y = Purchase_Categories), fill = "orange") +
geom_text(stat = "count", aes(y = Purchase_Categories, label = after_stat(count)), hjust = +2) +
labs(title = "Kategori Terlaris",
x = NULL,
y = NULL) +
theme_minimal() Dari plot di atas, dapat disimpulkan bahwa kategori pembelian
terlaris di Amazon yaitu Clothing and Fashion dan
Beauty and Personal Care, dengan jumlah pembelian yang
mirip yaitu 343 dan 317. Lalu diikuti oleh Home and Kitchen
dengan jumlah 219 pembelian, others dengan angka 166, lalu
Groceries and Gourmet Food dengan jumlah 111.
amazon %>%
ggplot() +
geom_bar(aes(x = Multiple_Categories), fill = "orange") +
geom_text(stat = "count", aes(x = Multiple_Categories, label = after_stat(count)), vjust = -0.5) +
labs(title = "Jumlah Pembelian",
x = NULL,
y = NULL) +
theme_minimal() Dari plot di atas, dapat ditemukan bahwa terdapat jumlah yang mirip antara pembeli yang membeli hanya satu barang dengan pembeli yang membeli barang dengan banyak kategori.
img-link : https://miro.medium.com/v2/resize:fit:720/format:webp/0*T5jaa2othYfXZX9W.
One-hot encoding menghasilkan representasi biner dari nilai kategori (sekarang menjadi kolom) di mana angka 1 mewakili keberadaan dan angka 0 mewakili absensi (Ashenden et al., 2021). Penggunaan metode ini memiliki beberapa keuntungan seperti:
# Pembuatan Fungsi untuk "One Hot Encode"
one_hot_encode <- function(data, col_name) {
data[[col_name]] <- as.factor(data[[col_name]])
encoded_cols <- model.matrix(~ . - 1, data = data[, col_name, drop = FALSE])
colnames(encoded_cols) <- gsub(" ", "_", colnames(encoded_cols)) # Replace spaces in column names
data <- cbind(data, encoded_cols)
return(data)
}
# Fungsi untuk encode seluruh faktor
encode_all_factors <- function(data) {
factor_columns <- names(data)[sapply(data, is.factor)]
for (col in factor_columns) {
data <- one_hot_encode(data, col)
}
return(data)
}
# Pembersihan nama kolom
colnames(amazon_sep) <- gsub(" ", "_", colnames(amazon_sep))
# Aplikasi ke data
encoded_amazon_sep <- encode_all_factors(amazon_sep)# Pilih kolom numerik
numeric_columns <- sapply(encoded_amazon_sep, is.numeric)
amazon_num <- encoded_amazon_sep[, numeric_columns, drop = FALSE]
# Hapus kolom konstan
non_constant_columns <- sapply(amazon_num, function(x) length(unique(x)) > 1)
amazon_num <- amazon_num[, non_constant_columns, drop = FALSE]
# Periksa apakah masih ada kolom numerik
if (ncol(amazon_num) > 0) {
# Standardisasi
amazon_scaled <- scale(amazon_num)
# PCA
amazon_pca <- prcomp(amazon_scaled)
# Summary dari PCA
summary(amazon_pca)
} else {
print("No numeric columns with more than one unique value.")
}## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 2.50716 2.16873 1.96814 1.60179 1.56102 1.51556 1.47959
## Proportion of Variance 0.07395 0.05533 0.04557 0.03019 0.02867 0.02702 0.02576
## Cumulative Proportion 0.07395 0.12929 0.17486 0.20504 0.23371 0.26073 0.28649
## PC8 PC9 PC10 PC11 PC12 PC13 PC14
## Standard deviation 1.40028 1.35260 1.34973 1.33636 1.30553 1.29101 1.27123
## Proportion of Variance 0.02307 0.02152 0.02143 0.02101 0.02005 0.01961 0.01901
## Cumulative Proportion 0.30956 0.33108 0.35251 0.37352 0.39357 0.41318 0.43219
## PC15 PC16 PC17 PC18 PC19 PC20 PC21
## Standard deviation 1.25621 1.24442 1.23676 1.20393 1.18092 1.17426 1.1588
## Proportion of Variance 0.01857 0.01822 0.01799 0.01705 0.01641 0.01622 0.0158
## Cumulative Proportion 0.45076 0.46898 0.48697 0.50403 0.52043 0.53666 0.5524
## PC22 PC23 PC24 PC25 PC26 PC27 PC28
## Standard deviation 1.15763 1.1403 1.13548 1.12426 1.11839 1.08975 1.08089
## Proportion of Variance 0.01577 0.0153 0.01517 0.01487 0.01472 0.01397 0.01375
## Cumulative Proportion 0.56822 0.5835 0.59868 0.61355 0.62827 0.64224 0.65599
## PC29 PC30 PC31 PC32 PC33 PC34 PC35
## Standard deviation 1.06636 1.05661 1.04446 1.03268 1.03123 1.01694 1.00840
## Proportion of Variance 0.01338 0.01313 0.01283 0.01255 0.01251 0.01217 0.01196
## Cumulative Proportion 0.66936 0.68250 0.69533 0.70788 0.72039 0.73256 0.74452
## PC36 PC37 PC38 PC39 PC40 PC41 PC42
## Standard deviation 1.00078 0.98241 0.9669 0.96209 0.95721 0.95269 0.9493
## Proportion of Variance 0.01178 0.01135 0.0110 0.01089 0.01078 0.01068 0.0106
## Cumulative Proportion 0.75630 0.76766 0.7787 0.78954 0.80032 0.81100 0.8216
## PC43 PC44 PC45 PC46 PC47 PC48 PC49
## Standard deviation 0.92251 0.9221 0.91118 0.90389 0.87870 0.8746 0.8650
## Proportion of Variance 0.01001 0.0100 0.00977 0.00961 0.00908 0.0090 0.0088
## Cumulative Proportion 0.83162 0.8416 0.85139 0.86100 0.87008 0.8791 0.8879
## PC50 PC51 PC52 PC53 PC54 PC55 PC56
## Standard deviation 0.85663 0.84598 0.82747 0.82220 0.80194 0.78862 0.76920
## Proportion of Variance 0.00863 0.00842 0.00806 0.00795 0.00757 0.00732 0.00696
## Cumulative Proportion 0.89652 0.90494 0.91299 0.92095 0.92851 0.93583 0.94279
## PC57 PC58 PC59 PC60 PC61 PC62 PC63
## Standard deviation 0.76326 0.75148 0.73884 0.73082 0.72318 0.69288 0.66160
## Proportion of Variance 0.00685 0.00664 0.00642 0.00628 0.00615 0.00565 0.00515
## Cumulative Proportion 0.94964 0.95629 0.96271 0.96899 0.97515 0.98080 0.98594
## PC64 PC65 PC66 PC67 PC68 PC69
## Standard deviation 0.64748 0.63305 0.61214 1.804e-15 1.464e-15 1.285e-15
## Proportion of Variance 0.00493 0.00471 0.00441 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion 0.99088 0.99559 1.00000 1.000e+00 1.000e+00 1.000e+00
## PC70 PC71 PC72 PC73 PC74
## Standard deviation 1.189e-15 1.162e-15 1.067e-15 9.938e-16 9.121e-16
## Proportion of Variance 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
## PC75 PC76 PC77 PC78 PC79
## Standard deviation 8.2e-16 7.389e-16 6.694e-16 6.686e-16 5.988e-16
## Proportion of Variance 0.0e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion 1.0e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
## PC80 PC81 PC82 PC83 PC84
## Standard deviation 5.825e-16 5.071e-16 4.176e-16 2.931e-16 1.745e-16
## Proportion of Variance 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
## Cumulative Proportion 1.000e+00 1.000e+00 1.000e+00 1.000e+00 1.000e+00
## PC85
## Standard deviation 4.273e-17
## Proportion of Variance 0.000e+00
## Cumulative Proportion 1.000e+00
# Generating biplot
biplot(x = amazon_pca, # data pca_small yang sudah diambil 100 data untuk contoh
cex = 0.3, # untuk mengatur ukuran font panah-panah merah
scale = F) # kita hanya lakukan scaling saat pembuatan PCA menggunakan prcomp()# WSS method
wss_plot <- fviz_nbclust(
x = amazon_num,
FUNcluster = kmeans,
method = "wss"
)
wss_plotDari plot di atas, dapat ditemukan bahwa kmeans yang optimal yaitu merupakan 3 karena setelah angka tersebut garis mulai mendatar sehingga membentuk 90°
## [1] 2.507160e+00 2.168734e+00 1.968139e+00 1.601788e+00 1.561023e+00
## [6] 1.515560e+00 1.479594e+00 1.400278e+00 1.352604e+00 1.349735e+00
## [11] 1.336356e+00 1.305527e+00 1.291011e+00 1.271234e+00 1.256211e+00
## [16] 1.244424e+00 1.236756e+00 1.203925e+00 1.180921e+00 1.174260e+00
## [21] 1.158766e+00 1.157627e+00 1.140335e+00 1.135478e+00 1.124265e+00
## [26] 1.118395e+00 1.089749e+00 1.080893e+00 1.066358e+00 1.056606e+00
## [31] 1.044464e+00 1.032685e+00 1.031227e+00 1.016935e+00 1.008400e+00
## [36] 1.000781e+00 9.824141e-01 9.668523e-01 9.620946e-01 9.572086e-01
## [41] 9.526935e-01 9.493338e-01 9.225119e-01 9.221340e-01 9.111791e-01
## [46] 9.038933e-01 8.786972e-01 8.745788e-01 8.650098e-01 8.566349e-01
## [51] 8.459844e-01 8.274677e-01 8.222008e-01 8.019371e-01 7.886200e-01
## [56] 7.692029e-01 7.632613e-01 7.514772e-01 7.388427e-01 7.308250e-01
## [61] 7.231787e-01 6.928848e-01 6.615996e-01 6.474831e-01 6.330540e-01
## [66] 6.121380e-01 1.803553e-15 1.464170e-15 1.284810e-15 1.189102e-15
## [71] 1.161794e-15 1.067052e-15 9.937613e-16 9.120794e-16 8.200087e-16
## [76] 7.388856e-16 6.693775e-16 6.686153e-16 5.987753e-16 5.825488e-16
## [81] 5.071319e-16 4.175535e-16 2.930636e-16 1.744741e-16 4.273409e-17
# Mengecek kmeans
amazon_wss <- kmeans(x = amazon_num,
centers = 3) # Inputting K
# Mengecek keoptimalan
amazon_wss$betweenss /amazon_wss$totss## [1] 0.7658934
Rasio tersebut sudah termasuk bagus karena BSS/TSS ~ 1.
- Age : Max(3), Min(2)
- Customer_Reviews_Importance : Max(3), Min (2)
- Personalized Recommendation_Frequency.1 : Max(3),
Min(1)
- Rating_Accuracy : Max(3), Min(1)
- Shopping_Satisfaction : Max(3), Min(1)
- Overall_Satisfaction : Max(2), Min(1)
PURCHASING_CATEGORIES
- Beauty_and_Personal_Care : Max(3), Min (1)
- Clothing_and_Fashion : Max(2), Min (3)
- Groceries_and_Gourmet_Food : Max(3), Min (2)
- Home_and_Kitchen : Max(3), Min (2)
- others : Max(2), Min (1)
GENDER
- Female : Max(2), Min(3)
- Male : Max(3), Min (2)
- Prefer_not_to_say : Max(3), Min (2)
- Others : Max(3), Min(2)
Purchase_Frequency
- Multiple_times_a_week : Max(1), Min (2)
- Once_a_week : Max(1), Min(2)
- Few_times_a_month : Max(3), Min(2)
- Once_a_month : Max(2), Min (3)
- Less_than_once_a_month : Max(2), Min(1)
Personalized_Recommendation_Frequency
- Yes : Max(1), Min(3)
- Sometimes : Max(3), Min(2)
- No : Max(2), Min (3)
Browsing_Frequency
- Multiple_times_a_day : Max(3), Min (2)
- Few_times_a_week : Max(1), Min (2)
- Few_times_a_month : Max(2), Min(3)
- Rarely : Max(3), Min(1)
Product_Search_Method
- Categories : Max(1), Min (2)
- Filter : Max(3), Min (2)
- Keyword : Max(2), Min(1)
- others : Max(1), Min(2)
Search_Result_Exploration
- First_page : Max(1), Min (2)
- Multiple_pages : Max(2), Min (1)
Add_to_Cart_Browsing
- Yes : Max(2), Min (3)
- Maybe : Max(3), Min (2)
- No : Max(1), Min (2)
Cart_Completion_Frequency
- Always : Max(3), Min (2)
- Often : Max(1), Min (3)
- Sometimes : Max(2), Min (1)
- Rarely : Max(3), Min (1)
- Never : Max(3), Min (2)
Cart_Abandonment_Factors
- High_shipping_costs : Max(2), Min (1)
- Found_a_better_price_elsewhere : Max(2), Min (3)
- Changed_my_mind_or_no_longer_need_the_item : Max(1),
Min (2)
- others : Max(3), Min (1)
Saveforlater_Frequency
- Always : Max(2), Min (1)
- Often : Max(1), Min (2)
- Sometimes : Max(3), Min (1)
- Rarely : Max(2), Min (1)
- Never : Max(1), Min (3)
Review_left
- Yes : Max(3), Min (2)
- No : Max(2), Min (3)
Review_Reliability
- Heavily : Max(2), Min (3)
- Moderately : Max(1), Min (2)
- Occasionally : Max(3), Min (2)
- Rarely : Max(1), Min (2)
- Never : Max(3), Min (2)
Review_Helpfulness
- Yes : Max(2), Min (3)
- Sometimes : Max(3), Min (2)
- No : Max(3), Min (2)
Recommendation_Helpfulness
- Yes : Max(2), Min (1)
- Sometimes : Max(3), Min (1)
- No : Max(1), Min (2)
Service_Appreciation
- Customer_service : Max(1), Min (2 & 3)
- Competitive prices : Max(3), Min (1 & 2)
- All_the_above : Max(1), Min (2 & 3)
Improvement_Areas
- Add_more_familiar_brands_to_the_list : Max(2), Min (1
& 3)
- better_app_interface_and_lower_shipping_charges :
Max(2), Min (1 & 3)
- Customer_service_responsiveness : Max(1), Min (2)
- Nothing : Max(3), Min (1)
-
I_have_no_problem_with_Amazon_yet._But_others_tell_me_about_the_refund_issues_
: Max(1 & 2), Min (3)
- Irrelevant_product_suggestions : Max(1), Min (2 &
3)
- Product_quality_and_accuracy : Max(2), Min (3)
-
Quality_of_product_is_very_poor_according_to_the_big_offers
: Max(1), Min (2 & 3)
- Reducing_packaging_waste : Max(3), Min (2)
- User_interface : Max(2), Min (3)
- Shipping_speed_and_reliability : Max(2), Min (1)
Multiple_Categories
- Single_Item : Max(3), Min(1)
- Multiple_Items : Max(1), Min(3)
Pembeli dalam klaster ini cenderung memiliki kepuasan belanja dan kepuasan umum yang rendah dengan rata-rata usia 34 tahun. Mereka jarang berbelanja dalam kategori Beauty and Personal Care. Meskipun sering berbelanja setiap minggu, mereka lebih suka rekomendasi personal yang rendah. Pembeli ini aktif melakukan penelusuran di Amazon beberapa kali seminggu, lebih memilih kategori daripada kata kunci. Meskipun hanya sering menjelajahi halaman pertama, mereka kurang tertarik untuk menggunakan fitur Add to Cart. Faktor peninggalkan keranjang belanja sering terjadi karena perubahan pikiran pembeli. Meskipun sering menggunakan fitur Save for Later, tingkat Recommendation Helpfulness mereka rendah. Dalam pelayanan, mereka cenderung menyukai hampir seluruh aspek Amazon, terutama pelayanan pelanggan, namun memberikan masukan bahwa responsivitas dalam customer service perlu ditingkatkan.
Ciri klaster ini yaitu :
Pelanggan klaster ini memiliki umur rata-rata 23 tahun menunjukkan tingkat kepuasan yang tinggi secara keseluruhan. Mereka cenderung membeli produk dalam kategori “Clothing and Fashion” dan kategori lainnya. Mayoritas dari mereka adalah perempuan, melakukan pembelian barang setiap bulan atau dengan frekuensi yang lebih rendah. Meskipun mereka tidak sering mendapatkan rekomendasi yang disesuaikan, mereka aktif melakukan penelusuran produk dengan menggunakan metode keyword. Selama proses pencarian, mereka biasanya mengeksplorasi beberapa halaman sebelum memutuskan untuk membeli dan menggunakan fitur “Add to Cart.” Faktor-faktor yang dapat membatalkan pembelian termasuk “High Shipping Cost” dan menemukan harga yang lebih baik di tempat lain. Selain itu, pelanggan ini sering menggunakan fitur “Save for Later” dan meskipun jarang meninggalkan ulasan, mereka menganggap ulasan dari orang lain bermanfaat, serta menilai rekomendasi sebagai informasi yang berguna.
Ciri klaster ini yaitu :
Rata-rata pelanggan klaster ini berusia 48 tahun, memberikan prioritas tinggi pada ulasan produk, dan sering mendapatkan rekomendasi yang disesuaikan dengan preferensi mereka. Mereka menunjukkan kepuasan belanja yang tinggi dan cenderung membeli kategori barang seperti “Beauty and Personal Care,” “Groceries and Gourmet Food,” serta “Home and Kitchen.” Mayoritas pelanggan adalah laki-laki, “Prefer not to say,” dan “others.” Pembelian dilakukan beberapa kali dalam sebulan dengan frekuensi browsing yang terbagi antara yang selalu dan jarang. Pelanggan cenderung mencari produk menggunakan metode filter, secara aktif meninggalkan ulasan produk, meskipun mereka tidak sepenuhnya menganggap ulasan orang lain bermanfaat. Selain itu, mereka cenderung membeli hanya satu jenis kategori barang.
Ciri klaster ini yaitu :
# Penamaan kembali klaster
amazon_sep <- amazon_sep %>%
mutate(cluster = recode(cluster, "1" = "Diverse Shopper"),
cluster = recode(cluster, "2" = "Simplistic Shopper"),
cluster = recode(cluster, "3" = "Seasoned Shopper"))# Plotting
amazon_sep %>%
ggplot() +
geom_bar(aes(x = cluster), fill = "orange") +
geom_text(stat = "count", aes(x = cluster, label = after_stat(count)), vjust = -0.5) +
labs(title = "Pembagian Klaster",
subtitle = "Kustomer Amazon",
x = "Klaster",
y = NULL) +
theme_minimal()# 2D Plotting Kluster
amazon_num$cluster <- as.factor(amazon_wss$cluster) # Penambahan kolom cluster
fviz_cluster(object = amazon_wss, data = amazon_num %>% select(-cluster)) # PlottingDari plot di atas, susah dibaca perbedaannya antar cluster 1,2, dan 3 akibat Cumulative Proportion yang rendah pada tiap Dim. Terlihat pada plot di atas Dim1 mengandung 7.4% data, dan Dim2 mengandung 5.5% data.
Analisis Komponen Utama (Principal Component Analysis atau PCA) adalah metode statistik yang digunakan untuk mereduksi dimensi dalam analisis data. PCA mentransformasi set variabel yang saling berkorelasi menjadi set variabel yang tidak berkorelasi, yang disebut komponen utama. Komponen ini menangkap informasi paling signifikan dalam data, memungkinkan representasi yang disederhanakan sambil tetap mempertahankan pola dan tren utama. PCA banyak digunakan dalam berbagai bidang, seperti pemrosesan gambar, pembelajaran mesin, dan ekstraksi fitur, untuk menyederhanakan data dan meningkatkan efisiensi komputasi.
# Pembuatan model PCA
amazon_pca1 <- PCA(amazon_num[,-86], graph = F ,quanti.sup = 85) # menghilangkan kolom cluster
amazon_pca1$eig## eigenvalue percentage of variance cumulative percentage of variance
## comp 1 6.195950e+00 7.376131e+00 7.376131
## comp 2 4.701618e+00 5.597165e+00 12.973295
## comp 3 3.626865e+00 4.317696e+00 17.290992
## comp 4 2.551091e+00 3.037013e+00 20.328005
## comp 5 2.319439e+00 2.761237e+00 23.089242
## comp 6 2.190337e+00 2.607545e+00 25.696787
## comp 7 1.984678e+00 2.362712e+00 28.059498
## comp 8 1.926935e+00 2.293970e+00 30.353469
## comp 9 1.828893e+00 2.177253e+00 32.530722
## comp 10 1.819809e+00 2.166440e+00 34.697162
## comp 11 1.785144e+00 2.125171e+00 36.822332
## comp 12 1.703909e+00 2.028463e+00 38.850795
## comp 13 1.657764e+00 1.973528e+00 40.824323
## comp 14 1.615340e+00 1.923024e+00 42.747347
## comp 15 1.575646e+00 1.875769e+00 44.623116
## comp 16 1.547962e+00 1.842812e+00 46.465928
## comp 17 1.521220e+00 1.810976e+00 48.276904
## comp 18 1.438888e+00 1.712962e+00 49.989866
## comp 19 1.394552e+00 1.660181e+00 51.650047
## comp 20 1.372491e+00 1.633918e+00 53.283965
## comp 21 1.342209e+00 1.597867e+00 54.881832
## comp 22 1.330794e+00 1.584279e+00 56.466111
## comp 23 1.294589e+00 1.541177e+00 58.007288
## comp 24 1.267797e+00 1.509282e+00 59.516570
## comp 25 1.262145e+00 1.502554e+00 61.019124
## comp 26 1.243444e+00 1.480291e+00 62.499415
## comp 27 1.187414e+00 1.413588e+00 63.913003
## comp 28 1.168328e+00 1.390867e+00 65.303869
## comp 29 1.131287e+00 1.346770e+00 66.650639
## comp 30 1.115312e+00 1.327752e+00 67.978392
## comp 31 1.090383e+00 1.298075e+00 69.276467
## comp 32 1.066365e+00 1.269483e+00 70.545950
## comp 33 1.062761e+00 1.265192e+00 71.811141
## comp 34 1.034116e+00 1.231091e+00 73.042232
## comp 35 1.006956e+00 1.198758e+00 74.240990
## comp 36 9.986797e-01 1.188904e+00 75.429894
## comp 37 9.651356e-01 1.148971e+00 76.578865
## comp 38 9.342207e-01 1.112168e+00 77.691033
## comp 39 9.245899e-01 1.100702e+00 78.791735
## comp 40 9.077959e-01 1.080709e+00 79.872444
## comp 41 9.038383e-01 1.075998e+00 80.948442
## comp 42 8.888010e-01 1.058096e+00 82.006539
## comp 43 8.507667e-01 1.012818e+00 83.019356
## comp 44 8.493937e-01 1.011183e+00 84.030539
## comp 45 8.228087e-01 9.795341e-01 85.010073
## comp 46 8.168450e-01 9.724345e-01 85.982508
## comp 47 7.721071e-01 9.191751e-01 86.901683
## comp 48 7.647906e-01 9.104650e-01 87.812148
## comp 49 7.482231e-01 8.907418e-01 88.702890
## comp 50 7.330831e-01 8.727179e-01 89.575608
## comp 51 7.112038e-01 8.466712e-01 90.422279
## comp 52 6.829292e-01 8.130109e-01 91.235290
## comp 53 6.686309e-01 7.959891e-01 92.031279
## comp 54 6.363986e-01 7.576174e-01 92.788896
## comp 55 6.215295e-01 7.399161e-01 93.528812
## comp 56 5.863299e-01 6.980118e-01 94.226824
## comp 57 5.745857e-01 6.840305e-01 94.910855
## comp 58 5.621497e-01 6.692258e-01 95.580080
## comp 59 5.456553e-01 6.495897e-01 96.229670
## comp 60 5.330591e-01 6.345942e-01 96.864264
## comp 61 5.229088e-01 6.225105e-01 97.486775
## comp 62 4.798548e-01 5.712557e-01 98.058030
## comp 63 4.377141e-01 5.210882e-01 98.579119
## comp 64 4.187523e-01 4.985146e-01 99.077633
## comp 65 4.001734e-01 4.763969e-01 99.554030
## comp 66 3.746147e-01 4.459699e-01 100.000000
## comp 67 2.162773e-28 2.574729e-28 100.000000
## comp 68 2.351776e-30 2.799733e-30 100.000000
## comp 69 2.188437e-30 2.605282e-30 100.000000
## comp 70 2.182537e-30 2.598258e-30 100.000000
## comp 71 1.912896e-30 2.277257e-30 100.000000
## comp 72 1.220041e-30 1.452430e-30 100.000000
## comp 73 1.096628e-30 1.305509e-30 100.000000
## comp 74 1.063739e-30 1.266355e-30 100.000000
## comp 75 8.095744e-31 9.637791e-31 100.000000
## comp 76 6.751429e-31 8.037415e-31 100.000000
## comp 77 6.395575e-31 7.613780e-31 100.000000
## comp 78 5.131513e-31 6.108943e-31 100.000000
## comp 79 4.531663e-31 5.394837e-31 100.000000
## comp 80 3.968845e-31 4.724816e-31 100.000000
## comp 81 3.600179e-31 4.285927e-31 100.000000
## comp 82 1.595755e-31 1.899709e-31 100.000000
## comp 83 1.503010e-31 1.789297e-31 100.000000
## comp 84 5.235548e-32 6.232795e-32 100.000000
amazon_cbind <- cbind(amazon_x, cluster = amazon_sep$cluster)
plot_ly(amazon_cbind, x = ~Dim.1, y = ~Dim.2, z = ~Dim.3, color = ~cluster, colors = c('orange', 'black', 'green')) %>%
add_markers() %>%
plotly::layout(scene = list(xaxis = list(title = 'Dim.1'),
yaxis = list(title = 'Dim.2'),
zaxis = list(title = 'Dim.3')))Di lihat dari plot di atas, data tidak dapat terbaca oleh 3D plot juga akibat setiap Dim hanya memiliki cumulative proportion yang kecil.
Melalui proses customer segmentation , pelanggan Amazon dibagi menjadi 3 cluster yaitu Cluster 1 (Diverse Shopper), Cluster 2 (Simplistic Shopper), dan Cluster 3 (Seasoned Shopper). Pembagian ketiga cluster ini yaitu menurut umur, cara pembelanjaan, dan penggunaan-penggunaan fitur. Namun setelah pembagian cluster, data persebaran tidak dapat dibaca akibat Cumulative proportion yang kecil pada tiap Dim.
Referensi:
Smart Insights. (2023, June 9). Smart Insights. Forecast E-Commerce Growth in Percentage of Online Retail / e-Commerce Sales 2017 to 2024. https://www.smartinsights.com/digital-marketing-strategy/online-retail-sales-growth/
Geršak, J. (2013). 3—Key issues in developing a garment collection. In J. Geršak (Ed.), Design of Clothing Manufacturing Processes (pp. 53–86). Woodhead Publishing. https://doi.org/10.1533/9780857097835.53
Zohuri, B., Mossavar-Rahmani, F., & Behgounia, F. (2022). Chapter 28—Artificial intelligence, machine learning, and deep learning use cases. In B. Zohuri, F. Mossavar-Rahmani, & F. Behgounia (Eds.), Knowledge is Power in Four Dimensions: Models to Forecast Future Paradigm (pp. 889–947). Academic Press. https://doi.org/10.1016/B978-0-323-95112-8.00028-3
Ashenden, S. K., Bartosik, A., Agapow, P.-M., & Semenova, E. (2021). Chapter 2—Introduction to artificial intelligence and machine learning. In S. K. Ashenden (Ed.), The Era of Artificial Intelligence, Machine Learning, and Data Science in the Pharmaceutical Industry (pp. 15–26). Academic Press. https://doi.org/10.1016/B978-0-12-820045-2.00003-9