assoc rules started
This commit is contained in:
26
Data.R
26
Data.R
@@ -1,11 +1,16 @@
|
||||
# Installing Packages
|
||||
#install.packages("ClusterR")
|
||||
#install.packages('gridExtra')
|
||||
#Run install.packages if you haven't installed it before (only once)
|
||||
#install.packages("cluster")
|
||||
|
||||
#install.packages('ggplot2')
|
||||
# Loading package
|
||||
#library(ClusterR)
|
||||
library(cluster)
|
||||
library(gridExtra)
|
||||
library(ggplot2)
|
||||
library(grid)
|
||||
library(arules)
|
||||
|
||||
|
||||
#Read spreadsheet file
|
||||
grocery_entries <- read.csv(file.choose())
|
||||
@@ -38,7 +43,18 @@ plot(sum_ages)
|
||||
|
||||
#kmeans --Yousri
|
||||
name_total_age<-cbind(grocery_entries[5],grocery_entries[3],grocery_entries[6])
|
||||
#x<-readline()
|
||||
k<-readline("Enter number of clusters: ")
|
||||
keameans<-cbind(grocery_entries[3],grocery_entries[6])
|
||||
result<-kmeans(keameans,centers = 10)
|
||||
final_result<-cbind(name_total_age,result$cluster)
|
||||
result<-kmeans(keameans,centers = k)
|
||||
final_result<-cbind(name_total_age,result$cluster)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Association Rules --Sewelam
|
||||
minsup <- readline("Enter minimum support: ")
|
||||
minconf <- readline("Enter minimum confidence: ")
|
||||
asoc_rules <- apriori(,parameter = list(supp = minsup,conf = minconf))
|
||||
write.csv(as(asoc_rules,"data.frame"),file = "pog.csv")
|
||||
Reference in New Issue
Block a user