Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions synthetic_simulations/.Rhistory
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
subset_sizes <- c(5, 20, 10, 40, 20, 5, 15, 50, 15) # Sizes of each subset
sum(subset_sizes)
########### START EDITING
problem = "problem_merge"
p_intra = 0.8
p_inter = 0.05
time_total = 100
time_interv = 10
time_steps <- seq(1,time_total, time_interv) # Number of time steps for each probability matrix
time_steps <- rep(time_interv, time_total/time_interv) # Number of time steps for each probability matrix
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/problem_merge.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
getwd()
setwd("/home/apascual/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/")
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
View(interaction_matrices)
library(gplots)
heatmap.2(interaction_matrices[[1]])
heatmap.2(interaction_matrices[[1]])
heatmap.2(interaction_matrices[[1]],
dendrogram = F,
scale = F,
trace = F)
heatmap.2(interaction_matrices[[1]],
dendrogram = F,
scale = NULL,
trace = F)
heatmap.2(interaction_matrices[[1]],
dendrogram = "none",
scale = "none",
trace = F)
heatmap.2(interaction_matrices[[1]],
dendrogram = "none",
scale = "none",
trace = NULL)
heatmap.2(interaction_matrices[[1]],
dendrogram = "none",
scale = "none",
trace = "none")
heatmap.2(interaction_matrices[[1]],
dendrogram = "none",
scale = "none",
trace = "none")
heatmap.2(interaction_matrices[[11]],
dendrogram = "none",
scale = "none",
trace = "none")
heatmap.2(interaction_matrices[[11]],
dendrogram = "none",
scale = "none",
trace = "none")
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
heatmap.2(interaction_matrices[[1]],
dendrogram = "none",
scale = "none",
trace = "none",
Rowv = F, Colv = F)
heatmap.2(interaction_matrices[[1]],
dendrogram = "none",
scale = "none",
trace = "none")#,
i=º
i=1
(i-1)*time_steps + 1
(i-1)*time_steps[i] + 1
(i-1)*time_steps[i-1] + 1
t0 = 1
((i-1)*t0 + 1)
i*time_steps[i]
interaction_matrices[[((i-1)*t0 + 1):i*time_steps[i]]]
sum(interaction_matrices[[((i-1)*t0 + 1):i*time_steps[i]]])/time_steps[i]
i=1
t = 0
int_tmp = 0
for(k in 1:time_steps[i]){
t = t + 1
int_tmp = int_tmp + interaction_matrices[[t]]
}
int_tmp = int_tmp / time_steps[i]
err_mat[[i]] = prob_matrices - int_tmp
# --- Create probability matrices
prob_matrices <- generate_probability_matrices(N, M, K, assignments_list, p_intra_list, p_inter_list)
err_mat[[i]] = prob_matrices[[i]] - int_tmp
err_mat = list()
err_mat[[i]] = prob_matrices[[i]] - int_tmp
err_tot[i] = sum(err_mat[[i]]^2)
err_tot = c()
err_tot[i] = sum(err_mat[[i]]^2)
err_tot[i] = sum(err_mat[[i]]^2)/(N^2)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
getwd()
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
########### START EDITING
problem = "problem_merge"
p_intra = 0.8
p_inter = 0.05
time_total = 100
time_interv = 10
time_steps <- rep(time_interv, time_total/time_interv) # Number of time steps for each probability matrix
# Set up environment and source functions --------
library(rprojroot)
dir.project = find_rstudio_root_file()
dir.project = find_rstudio_root_file()
setwd(dir.project)
dir.project
find_rstudio_root_file()
dir.project = find_rstudio_root_file()
setwd(dir.project)
dir.src = "src/"
dir.data = "data/"
setwd(dir.src)
problem_code = paste0(problem,".R")
library(gplots)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
dev.off()
dev.off()
dev.off()
err_mat = list()
err_tot = c()
t = 0
for(i in 1:(M-1)){
int_tmp = 0
for(k in 1:time_steps[i]){
t = t + 1
int_tmp = int_tmp + interaction_matrices[[t]]
}
int_tmp = int_tmp / time_steps[i]
err_mat[[i]] = prob_matrices[[i]] - int_tmp
err_tot[i] = sum(err_mat[[i]]^2)/(N^2)
file_prob = paste0("heatmap_prob-",i,"_",label,".pdf")
file_mat = paste0("heatmap_mat-",i,"_",label,".pdf")
pdf(file_prob)
heatmap.2(prob_matrices[[i]],
dendrogram = "none",
scale = "none",
trace = "none",
key.title = "", keysize = 0.7, density.info = "none",
cexRow = 0.2, cexCol = 0.2)
dev.off()
pdf(file_mat)
heatmap.2(interaction_matrices[[t]],
dendrogram = "none",
scale = "none",
trace = "none",
key.title = "", keysize = 0.7, density.info = "none",
cexRow = 0.2, cexCol = 0.2)
dev.off()
}
heatmap.2(prob_matrices[[i]],
dendrogram = "none",
scale = "none",
trace = "none",
key.title = "", keysize = 0.7, density.info = "none")#,
dev.off()
pdf(file_prob)
heatmap.2(prob_matrices[[i]],
dendrogram = "none",
scale = "none",
trace = "none",
key.title = "", keysize = 0.7, density.info = "none")#,
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
dev.off()
dev.off()
pdf(file_prob)
heatmap.2(prob_matrices[[i]],
dendrogram = "none",
scale = "none",
trace = "none",
key.title = "",
#keysize = 0.07,
density.info = "none",
cexRow = 0.2, cexCol = 0.2)
dev.off()
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
# Create structures ----------
# --- Determine structure of probability matrices
K = max(assignments_list[[length(assignments_list)]])
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/problem_merge-split.R", echo=TRUE)
source("~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src/main.R", echo=TRUE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sortOrder": [
{
"columnIndex": 2,
"ascending": true
}
],
"path": "~/Nextcloud/Research/Projects/Other/JonasLiechti/synthetic_simulations/src"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"activeTab": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"left": {
"splitterpos": 125,
"topwindowstate": "NORMAL",
"panelheight": 448,
"windowheight": 486
},
"right": {
"splitterpos": 213,
"topwindowstate": "NORMAL",
"panelheight": 448,
"windowheight": 486
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"TabSet1": 0,
"TabSet2": 0,
"TabZoom": {}
}
5 changes: 5 additions & 0 deletions synthetic_simulations/.Rproj.user/B72C84F1/rmd-outputs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@





Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"active_set":"","sets":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "0,0",
"scrollLine": "15"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "1,1",
"scrollLine": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "11,1",
"scrollLine": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "36,1",
"scrollLine": "25"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "38,41",
"scrollLine": "29"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "31,40",
"scrollLine": "20"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "3,13",
"scrollLine": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "16,0",
"scrollLine": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "1,29",
"scrollLine": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "0,0",
"scrollLine": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "3,4",
"scrollLine": "0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tempName": "Untitled1",
"source_window_id": "",
"Source": "Source",
"cursorPosition": "11,39",
"scrollLine": "11"
}
12 changes: 12 additions & 0 deletions synthetic_simulations/.Rproj.user/B72C84F1/sources/prop/INDEX
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fcode%2Fexample_use.R="00453D3B"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fcode%2Fgenerate_modify_partitions.R="4D36396E"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fcode%2Fgenerate_probability_matrices.R="E93FBDD4"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fcode%2Fsimulate_interactions.R="C1EE8567"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fexample_use.R="A3EB9E9B"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fgenerate_modify_partitions.R="62C07B87"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fgenerate_probability_matrices.R="D273609E"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fmain.R="C10FA551"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fproblem_merge-split-drift.R="7A35E363"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fproblem_merge-split.R="EE16815C"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fproblem_merge.R="0DB8765E"
~%2FNextcloud%2FResearch%2FProjects%2FOther%2FJonasLiechti%2Fsynthetic_simulations%2Fsrc%2Fsimulate_interactions.R="EA5B63E2"
Loading