summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-12-09 13:27:27 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-12-09 13:27:27 +0100
commit9358e86f72db4acc4682cdfbed8f02d7cb073cde (patch)
treee18d3e09b978afe3eab2eb53f324b9dd62d6664f
parent3a4c5500f7c3e139fbb44b2c98343bd0091ae593 (diff)
Update
-rw-r--r--analysis/analysis.R32
-rw-r--r--analysis/days.R47
-rw-r--r--analysis/figures/combined.pdfbin1161922 -> 1123336 bytes
-rw-r--r--analysis/figures/dimension_energy-coverage-policy.pdfbin139310 -> 139310 bytes
-rw-r--r--analysis/figures/dimension_energy-coverage-wakeupfor.pdfbin137643 -> 137643 bytes
-rw-r--r--analysis/figures/dimension_energy-coverage.pdfbin149152 -> 98704 bytes
-rw-r--r--analysis/figures/months_accuracy.pdfbin0 -> 11833 bytes
-rw-r--r--analysis/figures/months_f1-score.pdfbin0 -> 8120 bytes
-rw-r--r--analysis/kmeans.R51
-rw-r--r--analysis/renv.lock99
-rw-r--r--slides_recap/main.log18
-rw-r--r--slides_recap/main.pdfbin296943 -> 296990 bytes
-rw-r--r--slides_recap/main.tex15
13 files changed, 221 insertions, 41 deletions
diff --git a/analysis/analysis.R b/analysis/analysis.R
index 8a76849..bd27626 100644
--- a/analysis/analysis.R
+++ b/analysis/analysis.R
@@ -1,4 +1,5 @@
library("tidyverse")
+library("viridis")
## Simulation Parameters:
## simkey {baseline,extended,hint,hintandextended}
@@ -19,7 +20,7 @@ nwireless=2
nsimkey=4
nsimulations=nseed*nwakeupfor*nwireless*nsimkey # Must be 3200
-if(1==2){
+if(FALSE){ # Toggle
## Load data
data=read_csv("../CCGRID2022.csv")%>%distinct() # Note that in the data experiment wireless=="lora",seed==1,wakeupfor==60,simkey=="baseline" is present 2 times in the CSV file
tmp_data_coverage=data%>%group_by(simkey,wireless,wakeupfor,seed)%>%mutate(coverage=sum(nDataRcv))%>%ungroup()%>%filter(isSender==1)%>%select(simkey,wireless,wakeupfor,seed,coverage)
@@ -42,24 +43,17 @@ sim=sim%>%mutate(id_rand=rand_id[id])
}
## Perform various plots to understand the data
GG_VARIOUS=function(){
- ## Dimension Coverage
- ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(simkey,coverage,color=wakeupfor))+geom_point()+facet_wrap(~wireless+wakeupfor)+ggtitle("Dimension Coverage")
- ggsave("figures/dimension_coverage.pdf")
- ## Dimension Energy
- ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(simkey,energy,color=wakeupfor))+geom_point()+facet_wrap(~wireless+wakeupfor)+ggtitle("Dimension Energy")+ylab("Energy Consumption (J)")
- ggsave("figures/dimension_energy.pdf")
- ## Dimension Efficiency
- ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(simkey,efficiency,color=wakeupfor))+
- geom_point()+facet_wrap(~wireless+wakeupfor)+ggtitle("Dimension Efficiency")+ylab("Efficiency (J/Succ)")
- ggsave("figures/dimension_efficiency.pdf")
## Dimension Energy/Coverage
ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
- aes(coverage,energy,color=simkey))+geom_point(alpha=0.5)+labs(color="Policy")+theme(legend.position="top")+
- ggtitle("Dimension Energy/Coverage")+xlab("Coverage")+ylab("Nodes energy consumption (J)")+
- facet_wrap(~wakeupfor+wireless,scale="free")
+ aes(coverage,energy,color=simkey))+geom_point(aes(shape=simkey),alpha=0.5)+labs(color="Policy")+
+ xlab("Network coverage")+ylab("Nodes energy consumption (J)")+
+ scale_shape_manual(values=c(22, 15, 16,1))+labs(shape="Policy",color="Policy")+
+ theme_bw()+
+ guides(colour = guide_legend(override.aes = list(alpha = 1)))+
+ facet_wrap(~wakeupfor+wireless,scale="free")+scale_color_viridis(discrete=TRUE)+
+ theme(legend.position = c(0.15,0.87),
+ legend.background = element_rect(fill = "white", color = "black",size=0.8))+
+ scale_x_continuous(breaks=seq(0,12))
ggsave("figures/dimension_energy-coverage.pdf")
## Dimension Energy/Coverage Wakeupfor
ggplot(data_seed%>%mutate(wakeupfor=as.character(wakeupfor)),
@@ -114,8 +108,8 @@ GG_SIMULATIONS = function(file,key="NOKEY") {
}
-GG_SIMULATIONS("../simulations/results/results_NoHintIsFALSE.csv",key="WITH_HINT")
-GG_SIMULATIONS("../simulations/results/results_NoHintIsTRUE.csv",key="NO_HINT")
+#GG_SIMULATIONS("../simulations/results/results_NoHintIsFALSE.csv",key="WITH_HINT")
+#GG_SIMULATIONS("../simulations/results/results_NoHintIsTRUE.csv",key="NO_HINT")
system("rm -f figures/combined.pdf")
system("pdfunite figures/*.pdf figures/combined.pdf")
diff --git a/analysis/days.R b/analysis/days.R
index ce12930..2b671d1 100644
--- a/analysis/days.R
+++ b/analysis/days.R
@@ -107,11 +107,12 @@ generate_accuracy = function(wireless,wakeupfor,steps=10, accuracy=10,ignore_hin
}
# Generate accuracy for each wireless and uptime
-#accuracy=rbind(generate_accuracy("lora",60),
-# generate_accuracy("lora",180),
-# generate_accuracy("nbiot",60),
-# generate_accuracy("nbiot",180))
-
+if(F){ # Toggle to train
+accuracy=rbind(generate_accuracy("lora",60),
+ generate_accuracy("lora",180),
+ generate_accuracy("nbiot",60),
+ generate_accuracy("nbiot",180))
+}
## Summarize
result_summary=accuracy%>%group_by(wireless,wakeupfor,months,model)%>%
summarize(
@@ -125,7 +126,41 @@ result_summary=accuracy%>%group_by(wireless,wakeupfor,months,model)%>%
metrics_peak=result_summary%>%group_by(wireless,wakeupfor,model)%>%
summarize(max_accuracy=max(mean_accuracy))
-## Plot
+
+ggplot(data=result_summary%>%mutate(model=ifelse(model=="knn","KNN","DT")),aes(linetype=model))+
+ geom_line(aes(months,mean_f1_baseline,color="Baseline"),size=1.2)+
+ geom_line(aes(months,mean_f1_extended,color="Extended"),size=1.2)+
+ geom_line(aes(months,mean_f1_hintandextended,color="Hintandextended"),size=1.2)+labs(color="Classes",linetype="Model")+
+ facet_wrap(~wireless+wakeupfor)+
+ scale_x_continuous(breaks = seq(0, 15, by = 1))+
+ scale_y_continuous(breaks = seq(0, 1, by = 0.1))+
+ theme_bw()+
+ theme(panel.grid.minor = element_blank(),
+ legend.position = c(0.9,0.74),
+ legend.margin = margin(2,4,2,4),
+ legend.spacing=unit(-0.2,"cm"),
+ legend.box.margin=margin(1,1,1,1),
+ legend.box.background = element_rect(fill = "white", color = "black",size=0.8))+
+ xlab("Training months")+ylab("Classes F1-Score")+
+ scale_color_viridis(discrete=TRUE,end=0.7)
+ggsave("figures/months_f1-score.pdf",width=8.5,height=6)
+stopifnot(1)
+
+## Plot Merge Accuracy
+ggplot(data=result_summary%>%mutate(model=ifelse(model=="knn","KNN","DT")),aes(months,mean_accuracy,color=model,shape=model))+
+ geom_point(size=3)+geom_line(size=1.2)+xlab("Training months")+ylab("Model accuracy")+labs(color="Models",shape="Models")+
+ scale_x_continuous(breaks = seq(0, 15, by = 1))+
+ scale_y_continuous(breaks = seq(0, 1, by = 0.1))+
+ facet_wrap(~wireless+wakeupfor)+
+ theme_bw()+
+ theme(panel.grid.minor = element_blank(),
+ legend.position = c(0.38,0.68),
+ legend.background = element_rect(fill = "white", color = "black",size=0.8))+
+ scale_color_viridis(discrete=TRUE,end=0.7)
+ggsave("figures/months_accuracy.pdf",width=8.5,height=6)
+
+
+## Plot accuracy + F1-Score
sapply(c("knn","tree"),function(grp){
data=result_summary%>%filter(model==grp)
plot=ggplot(data,aes(months,mean_accuracy))+
diff --git a/analysis/figures/combined.pdf b/analysis/figures/combined.pdf
index 9a4ed4b..4d4b866 100644
--- a/analysis/figures/combined.pdf
+++ b/analysis/figures/combined.pdf
Binary files differ
diff --git a/analysis/figures/dimension_energy-coverage-policy.pdf b/analysis/figures/dimension_energy-coverage-policy.pdf
index c0440c7..8798a50 100644
--- a/analysis/figures/dimension_energy-coverage-policy.pdf
+++ b/analysis/figures/dimension_energy-coverage-policy.pdf
Binary files differ
diff --git a/analysis/figures/dimension_energy-coverage-wakeupfor.pdf b/analysis/figures/dimension_energy-coverage-wakeupfor.pdf
index 42869c6..77c2b09 100644
--- a/analysis/figures/dimension_energy-coverage-wakeupfor.pdf
+++ b/analysis/figures/dimension_energy-coverage-wakeupfor.pdf
Binary files differ
diff --git a/analysis/figures/dimension_energy-coverage.pdf b/analysis/figures/dimension_energy-coverage.pdf
index 6d7cf5c..91c195f 100644
--- a/analysis/figures/dimension_energy-coverage.pdf
+++ b/analysis/figures/dimension_energy-coverage.pdf
Binary files differ
diff --git a/analysis/figures/months_accuracy.pdf b/analysis/figures/months_accuracy.pdf
new file mode 100644
index 0000000..51c8440
--- /dev/null
+++ b/analysis/figures/months_accuracy.pdf
Binary files differ
diff --git a/analysis/figures/months_f1-score.pdf b/analysis/figures/months_f1-score.pdf
new file mode 100644
index 0000000..42557a8
--- /dev/null
+++ b/analysis/figures/months_f1-score.pdf
Binary files differ
diff --git a/analysis/kmeans.R b/analysis/kmeans.R
new file mode 100644
index 0000000..320ba8d
--- /dev/null
+++ b/analysis/kmeans.R
@@ -0,0 +1,51 @@
+########## INFORMATIONS ##########
+# This file is made to study online classification
+# So, each pair (wireless,wakeupfor) has its classification models (knn and decision tree)
+##################################
+
+library("tidyverse")
+options(dplyr.summarise.inform = FALSE)
+library("class")
+library("rpart")
+library("rpart.plot")
+library("viridis")
+library("MLmetrics")
+
+## Simulation Parameters:
+## simkey {baseline,extended,hint,hintandextended}
+## wireless {lora,nbiot}
+## wakeupfor {60s,180s}
+## seed [1,200]
+## node on[0,12]
+## isSender {0,1}
+## dataSize {1MB}
+
+## Metrics:
+## energy [0,+inf)
+## nDataRcv [0,+inf)
+
+nseed=200
+nwakeupfor=2
+nwireless=2
+nsimkey=4
+nsimulations=nseed*nwakeupfor*nwireless*nsimkey # Must be 3200
+
+## Load data
+data=suppressMessages(read_csv("../CCGRID2022.csv"))%>%distinct() # Note that in the data experiment wireless=="lora",seed==1,wakeupfor==60,simkey=="baseline" is present 2 times in the CSV file
+data_seed=data%>%group_by(simkey,wireless,wakeupfor,seed)%>%summarize(energy=sum(energy),coverage=sum(nDataRcv))%>% ungroup()
+
+## Format data
+data_seed=data_seed%>%filter(simkey!="hint")
+wireless_map=c("lora"=1,"nbiot"=2)
+simkey_map=c("baseline"=1,"hint"=2,"extended"=3,"hintandextended"=4)
+data_seed$wireless=wireless_map[data_seed$wireless]
+data_seed$simkey=simkey_map[data_seed$simkey]
+
+
+## Lora 180s
+data_kmean=data_seed%>%filter(wireless==1,wakeupfor==180)%>%select(-wireless,-wakeupfor,-seed)%>%relocate(simkey)
+m=kmeans(data_kmean,3,nstart=50,iter.max=80)
+data_kmean=data_kmean%>%mutate(cluster=as.factor(m$cluster))
+
+## plots
+ggplot(data=data_kmean,aes(coverage,energy,color=as.factor(cluster)))+geom_point()
diff --git a/analysis/renv.lock b/analysis/renv.lock
index c51eb94..e597486 100644
--- a/analysis/renv.lock
+++ b/analysis/renv.lock
@@ -17,6 +17,14 @@
"Hash": "b2866e62bab9378c3cc9476a1954226b",
"Requirements": []
},
+ "KernSmooth": {
+ "Package": "KernSmooth",
+ "Version": "2.23-20",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "8dcfa99b14c296bc9f1fd64d52fd3ce7",
+ "Requirements": []
+ },
"MASS": {
"Package": "MASS",
"Version": "7.3-57",
@@ -25,6 +33,16 @@
"Hash": "71476c1d88d1ebdf31580e5a257d5d31",
"Requirements": []
},
+ "MLmetrics": {
+ "Package": "MLmetrics",
+ "Version": "1.1.1",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "c8c93b7ca030b43af9e0394700be4c7e",
+ "Requirements": [
+ "ROCR"
+ ]
+ },
"Matrix": {
"Package": "Matrix",
"Version": "1.4-1",
@@ -51,6 +69,16 @@
"Hash": "45f0398006e83a5b10b72a90663d8d8c",
"Requirements": []
},
+ "ROCR": {
+ "Package": "ROCR",
+ "Version": "1.0-11",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "cc151930e20e16427bc3d0daec62b4a9",
+ "Requirements": [
+ "gplots"
+ ]
+ },
"askpass": {
"Package": "askpass",
"Version": "1.1",
@@ -103,6 +131,14 @@
"bit"
]
},
+ "bitops": {
+ "Package": "bitops",
+ "Version": "1.0-7",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "b7d8d8ee39869c18d8846a184dd8a1af",
+ "Requirements": []
+ },
"blob": {
"Package": "blob",
"Version": "1.2.3",
@@ -150,6 +186,16 @@
"sass"
]
},
+ "caTools": {
+ "Package": "caTools",
+ "Version": "1.18.2",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "34d90fa5845004236b9eacafc51d07b2",
+ "Requirements": [
+ "bitops"
+ ]
+ },
"cachem": {
"Package": "cachem",
"Version": "1.0.6",
@@ -486,6 +532,28 @@
"vctrs"
]
},
+ "gplots": {
+ "Package": "gplots",
+ "Version": "3.1.3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "75437dd4c43599f6e9418ea249495fda",
+ "Requirements": [
+ "KernSmooth",
+ "caTools",
+ "gtools"
+ ]
+ },
+ "gridExtra": {
+ "Package": "gridExtra",
+ "Version": "2.3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "7d7f283939f563670a697165b2cf5560",
+ "Requirements": [
+ "gtable"
+ ]
+ },
"gtable": {
"Package": "gtable",
"Version": "0.3.1",
@@ -494,6 +562,14 @@
"Hash": "36b4265fb818f6a342bed217549cd896",
"Requirements": []
},
+ "gtools": {
+ "Package": "gtools",
+ "Version": "3.9.3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "32600a0bea839c4d0ac998d7c547ecf7",
+ "Requirements": []
+ },
"haven": {
"Package": "haven",
"Version": "2.5.1",
@@ -739,6 +815,17 @@
"askpass"
]
},
+ "patchwork": {
+ "Package": "patchwork",
+ "Version": "1.1.2",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "63b611e9d909a9ed057639d9c3b77152",
+ "Requirements": [
+ "ggplot2",
+ "gtable"
+ ]
+ },
"pillar": {
"Package": "pillar",
"Version": "1.8.1",
@@ -1181,6 +1268,18 @@
"rlang"
]
},
+ "viridis": {
+ "Package": "viridis",
+ "Version": "0.6.2",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "ee96aee95a7a563e5496f8991e9fde4b",
+ "Requirements": [
+ "ggplot2",
+ "gridExtra",
+ "viridisLite"
+ ]
+ },
"viridisLite": {
"Package": "viridisLite",
"Version": "0.4.1",
diff --git a/slides_recap/main.log b/slides_recap/main.log
index 9013888..1e2e498 100644
--- a/slides_recap/main.log
+++ b/slides_recap/main.log
@@ -1,4 +1,4 @@
-This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Arch Linux) (preloaded format=pdflatex 2022.11.14) 29 NOV 2022 14:38
+This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Arch Linux) (preloaded format=pdflatex 2022.11.14) 1 DEC 2022 09:49
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
@@ -894,7 +894,7 @@ File: ../analysis/figures/dimension_energy-coverage.pdf Graphic file (type pdf)
<use ../analysis/figures/dimension_energy-coverage.pdf>
Package pdftex.def Info: ../analysis/figures/dimension_energy-coverage.pdf use
-d on input line 117.
+d on input line 118.
(pdftex.def) Requested size: 227.64839pt x 227.64839pt.
[8
@@ -904,10 +904,10 @@ d on input line 117.
File: ../analysis/figures/tree_false.pdf Graphic file (type pdf)
<use ../analysis/figures/tree_false.pdf>
Package pdftex.def Info: ../analysis/figures/tree_false.pdf used on input line
- 124.
+ 125.
(pdftex.def) Requested size: 278.24034pt x 278.24034pt.
-Overfull \vbox (13.05038pt too high) detected at line 124
+Overfull \vbox (13.05038pt too high) detected at line 125
[]
[9
@@ -923,7 +923,7 @@ Overfull \vbox (13.05038pt too high) detected at line 124
File: ../analysis/figures/months_knn.pdf Graphic file (type pdf)
<use ../analysis/figures/months_knn.pdf>
Package pdftex.def Info: ../analysis/figures/months_knn.pdf used on input line
- 202.
+ 203.
(pdftex.def) Requested size: 247.16597pt x 219.70308pt.
[13
@@ -932,7 +932,7 @@ Package pdftex.def Info: ../analysis/figures/months_knn.pdf used on input line
File: ../analysis/figures/months_tree.pdf Graphic file (type pdf)
<use ../analysis/figures/months_tree.pdf>
Package pdftex.def Info: ../analysis/figures/months_tree.pdf used on input lin
-e 212.
+e 213.
(pdftex.def) Requested size: 247.16597pt x 219.70308pt.
[14
@@ -955,11 +955,11 @@ Package rerunfilecheck Info: File `main.out' has not changed.
Here is how much of TeX's memory you used:
21627 strings out of 478238
417405 string characters out of 5850455
- 680971 words of memory out of 5000000
+ 680905 words of memory out of 5000000
39382 multiletter control sequences out of 15000+600000
480453 words of font info for 68 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
- 128i,11n,122p,494b,423s stack positions out of 5000i,500n,10000p,200000b,80000s
+ 128i,11n,122p,494b,429s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/
texmf-dist/fonts/type1/public/amsfonts/cm/cmss10.pfb></usr/share/texmf-dist/fon
ts/type1/public/amsfonts/cm/cmss12.pfb></usr/share/texmf-dist/fonts/type1/publi
@@ -967,7 +967,7 @@ c/amsfonts/cm/cmss8.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/c
mssbx10.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmssi10.pfb><
/usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/tex
mf-dist/fonts/type1/public/amsfonts/symbols/msam10.pfb>
-Output written on main.pdf (15 pages, 296943 bytes).
+Output written on main.pdf (15 pages, 296990 bytes).
PDF statistics:
182 PDF objects out of 1000 (max. 8388607)
132 compressed objects within 2 object streams
diff --git a/slides_recap/main.pdf b/slides_recap/main.pdf
index 1f05590..cfbe5cf 100644
--- a/slides_recap/main.pdf
+++ b/slides_recap/main.pdf
Binary files differ
diff --git a/slides_recap/main.tex b/slides_recap/main.tex
index b72fbc4..892eb96 100644
--- a/slides_recap/main.tex
+++ b/slides_recap/main.tex
@@ -4,7 +4,7 @@
\usepackage{multirow}
%Information to be included in the title page:
-\title{Data dissemination policy predictions under energy consumption and network coverage constraints}
+\title{Multicast policy predictions under energy consumption and network coverage constraints}
\author{Loic Guegan, Issam Raïs}
\institute{UiT}
\date{2022}
@@ -37,24 +37,25 @@
\begin{frame}
\frametitle{Problem}
- Conditions:\\ \vspace{0.3cm}
+ \begin{center}
+ \textbf{How to choose the correct policy for a given setup?}
+ \end{center}
+ \vspace{0.8cm}
+ If:\\ \vspace{0.3cm}
\begin{itemize}
\item Perfect coverage not required:
\begin{itemize}
\item Just N+1,...,N+n redundancy (network coverage of n)
\item Collaboration of n nodes (e.g 3 to monitor a phenomenon)
\end{itemize}
- \item With a target energy budget
+ \item Have a target energy budget
\item Minimizing energy consumption not required (low energy target)
\end{itemize}
- \vspace{1cm}
- \centering
- \textbf{How to choose the correct policy for a given setup?}
\end{frame}
\begin{frame}
\frametitle{Problem}
- Knowing:
+ Inputs:
\begin{itemize}
\item Nodes setup:
\begin{itemize}