assoc rules started
This commit is contained in:
24
Data.R
24
Data.R
@@ -1,11 +1,16 @@
|
|||||||
# Installing Packages
|
# Installing Packages
|
||||||
#install.packages("ClusterR")
|
#install.packages('gridExtra')
|
||||||
#Run install.packages if you haven't installed it before (only once)
|
#Run install.packages if you haven't installed it before (only once)
|
||||||
#install.packages("cluster")
|
#install.packages("cluster")
|
||||||
|
#install.packages('ggplot2')
|
||||||
# Loading package
|
# Loading package
|
||||||
#library(ClusterR)
|
#library(ClusterR)
|
||||||
library(cluster)
|
library(cluster)
|
||||||
|
library(gridExtra)
|
||||||
|
library(ggplot2)
|
||||||
|
library(grid)
|
||||||
|
library(arules)
|
||||||
|
|
||||||
|
|
||||||
#Read spreadsheet file
|
#Read spreadsheet file
|
||||||
grocery_entries <- read.csv(file.choose())
|
grocery_entries <- read.csv(file.choose())
|
||||||
@@ -38,7 +43,18 @@ plot(sum_ages)
|
|||||||
|
|
||||||
#kmeans --Yousri
|
#kmeans --Yousri
|
||||||
name_total_age<-cbind(grocery_entries[5],grocery_entries[3],grocery_entries[6])
|
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])
|
keameans<-cbind(grocery_entries[3],grocery_entries[6])
|
||||||
result<-kmeans(keameans,centers = 10)
|
result<-kmeans(keameans,centers = k)
|
||||||
final_result<-cbind(name_total_age,result$cluster)
|
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