diff options
| author | leshe4ka46 <alex9102naid1@ya.ru> | 2025-11-15 16:30:38 +0300 |
|---|---|---|
| committer | leshe4ka46 <alex9102naid1@ya.ru> | 2025-11-18 14:05:14 +0300 |
| commit | 2ade61411a014b3eed24bd2b382687d55233a9b5 (patch) | |
| tree | 1b91eb11d38a0a053a7a806fedadb8c8a676738b /R_AR/main.r | |
| parent | 5aaff9711387ce1ea1ec8ee5c5b4ecd9e1ea3dd1 (diff) | |
R(Cluster)
Diffstat (limited to 'R_AR/main.r')
| -rwxr-xr-x | R_AR/main.r | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/R_AR/main.r b/R_AR/main.r new file mode 100755 index 0000000..fd1f653 --- /dev/null +++ b/R_AR/main.r @@ -0,0 +1,28 @@ +#!/usr/bin/env Rscript + +if (!require(arules)) install.packages("arules", repos = "https://cran.r-project.org/", Ncpus = 16) # nolint +library(arules) +if (!require(arulesViz)) install.packages("arulesViz", repos = "https://cran.r-project.org/", Ncpus = 16) # nolint +library(arulesViz) + + + +t <- read.transactions("AssociationRules.csv", format = "basket", sep = " ") +image(t) + +summary(t) + +# most freq +names(sort(itemFrequency(t), decreasing=TRUE)[1]) +# max amount of items +max(size(t)) + + +# 0..0.01 support, 0 confidence +rules0 <- apriori(t, parameter=list(supp=0.01, conf=0)) +length(rules0) +rules05 <- apriori(t, parameter=list(supp=0.01, conf=0.5)) +length(rules05) + +plot(rules0, measure=c("support", "confidence"), shading="lift") +plot(rules0, measure=c("support", "lift"))
\ No newline at end of file |
