Skip to content

Commit 6b30f32

Browse files
Imported dataset containing transactions in grocery store, created Sparse Matrix and visualised Frequency Plot
1 parent e5b5d78 commit 6b30f32

File tree

4 files changed

+15042
-23
lines changed

4 files changed

+15042
-23
lines changed

Part 4 - Clustering/Section 25 - Hierarchical Clustering/.Rhistory

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
}
2-
}
3-
for(r in regressor$coefficients)
4-
{
5-
print(r)
6-
else{
7-
print(regressor$coefficients)
8-
}
9-
}
10-
for(r in regressor$coefficients)
11-
{
12-
print(r)
13-
}
14-
summary(regressor)
15-
for(r in regressor$coefficients)
16-
{
17-
print(r[2])
18-
}
192
for(r in regressor$coefficients)
203
{
214
print(r[3])
@@ -493,20 +476,37 @@ SL = 0.05
493476
dataset = dataset[, c(1,2,3,4,5)]
494477
backwardElimination(training_set, SL)
495478
setwd("~/Desktop/Machine_Learning_Algorithms_R/Part 4 - Clustering/Section 25 - Hierarchical Clustering")
479+
library(cluster)
480+
clusplot (dataset,
481+
y_hc,
482+
lines = 0,
483+
shade = TRUE,
484+
color = TRUE,
485+
labels = 2,
486+
plotchar = FALSE,
487+
span = TRUE,
488+
main = paste('Clusters of customers'),
489+
xlab = "Annual Income",
490+
ylab = "Spending Score")
496491
dataset = read.csv("Mall_Customers.csv")
497-
dataset = read.csv("Mall_Customers.csv")
498-
View(dataset)
499492
dataset = dataset[4:5]
500-
View(dataset)
501493
dendrogram = hclust(d = dist(dataset,method = "euclidean"),
502494
method = "ward.D")
503-
View(dataset)
504495
plot(dendrogram,
505496
main = paste("Dendrogram"),
506497
xlab = "Customers",
507498
ylab = "Euclidean distances")
508499
hc = hclust(d = dist(dataset,method = "euclidean"),
509500
method = "ward.D")
510-
y_hc = cutree(ttree = hc, k = 5)
511501
y_hc = cutree(tree = hc, k = 5)
512-
y_hc
502+
clusplot (dataset,
503+
y_hc,
504+
lines = 0,
505+
shade = TRUE,
506+
color = TRUE,
507+
labels = 2,
508+
plotchar = FALSE,
509+
span = TRUE,
510+
main = paste('Clusters of customers'),
511+
xlab = "Annual Income",
512+
ylab = "Spending Score")

0 commit comments

Comments
 (0)