summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Green <ben@SEASITs-MacBook-Pro.local>2015-07-01 00:49:23 -0400
committerBen Green <ben@SEASITs-MacBook-Pro.local>2015-07-01 00:49:23 -0400
commit8e09ca6ca68c71bdab65525b529e2adfa281823c (patch)
treed395bfcb0f9f0bc1092072ae1a8a9d3ad9c98a4a
parent6e527bbf612465bf5d739b9652abc0165550993c (diff)
downloadcriminal_cascades-8e09ca6ca68c71bdab65525b529e2adfa281823c.tar.gz
Got predict-victims running in parallel, drastically reducing the time
for each test. Also changed how we get the rankings of infected individuals each day.
-rw-r--r--R Scripts/find-parents.R15
-rw-r--r--R Scripts/generate-network.R40
-rw-r--r--R Scripts/predict-victims-plots.R9
-rw-r--r--R Scripts/predict-victims.R39
-rw-r--r--experiments/build_network.py3
-rwxr-xr-xexperiments/ml2.sobin123652 -> 123652 bytes
-rw-r--r--experiments/out.log255
-rw-r--r--experiments/process.py42
8 files changed, 113 insertions, 290 deletions
diff --git a/R Scripts/find-parents.R b/R Scripts/find-parents.R
index 3ec8809..023d7ba 100644
--- a/R Scripts/find-parents.R
+++ b/R Scripts/find-parents.R
@@ -6,8 +6,8 @@
# source('criminal_cascades/R Scripts/structural.R')
##### Initialize parameters based on what ml2 found
-alpha = 0.061
-delta = 0.082
+alpha = 0.18
+delta = 0.09
##### Get weights
edges = dag_dat_test[!is.na(dag_dat_test$t2),]
@@ -21,20 +21,27 @@ weights = p/p_tilde
edges$weight = weights
##### Find most likely parents
-parents = data.frame(vic=0,Npars=0,par_rank=0)
+parents = data.frame(vic=0,Npars=0,par_rank=0,rand_rank=0)
vics = setdiff(vic_ids,seeds)
+print(length(vics))
for (u in vics){
+ if(which(vics==u) %% 500 == 0) print(which(vics==u))
u_parents = edges[edges$to==u,]
u_parents = u_parents[order(u_parents$weight,decreasing=T),]
Nparents = dim(u_parents)[1]
infector = V(g)$infector[u]
infectorID = which(u_parents$from==infector)
- parents[which(vics==u),] = c(u, Nparents, infectorID)
+ randID = sample(1:Nparents,1)
+ parents[which(vics==u),] = c(u, Nparents, infectorID, randID)
}
##### Get some summary statistics on how well
+mean(parents$par_rank==1)
median(parents$par_rank[parents$Npars>9])
median(parents$par_rank[parents$Npars>99])
+edges[edges$to==2847,]
+## baseline alg
+# for each vic, find potential parents, pick one at random
diff --git a/R Scripts/generate-network.R b/R Scripts/generate-network.R
index 3b40969..dab81a4 100644
--- a/R Scripts/generate-network.R
+++ b/R Scripts/generate-network.R
@@ -3,20 +3,20 @@ setwd("~/Documents/Cascade Project/")
source('criminal_cascades/R Scripts/temporal.R')
source('criminal_cascades/R Scripts/structural.R')
-alpha = 1/100
-beta = 0.02
-delta = 0.15
+alpha = 1/10
+beta = 0.01
+delta = 0.25
# lmbda = 1/10
t_max = 1000
N = 5000
g = forest.fire.game(nodes=N, fw.prob=0.3, ambs=1, directed=F)
-plot(g, vertex.size=5, vertex.label=NA)
+plot(g, vertex.size=3, vertex.label=NA)
V(g)$seed = runif(vcount(g))<beta
seeds = which(V(g)$seed)
V(g)$vic = V(g)$seed
-V(g)$vic.day[V(g)$seed] = sample(1:t_max, sum(V(g)$seed))
+V(g)$vic.day[V(g)$seed] = 1#sample(1:t_max, sum(V(g)$seed))
V(g)$spawn.date = 0
V(g)$infector = NA
@@ -28,17 +28,19 @@ for (day in 1:t_max){
dists = as.numeric(shortest.paths(g,vic,neighbors))
infected = neighbors[which(runif(length(neighbors))<structural(delta, dists))]
infected = setdiff(infected,seeds) # don't try to infect seeds
- inf.days = day + ceiling(alpha*rexp(length(infected),alpha))
+ inf.days = day + ceiling(rexp(length(infected),alpha))
+ realized = ((inf.days <= V(g)$vic.day[infected]) %in% c(NA,T)) & (inf.days<=t_max)
+ infected = infected[realized]
V(g)$vic[infected] = TRUE
- infects = (inf.days <= V(g)$vic.day[infected]) %in% c(NA,T)
- V(g)$vic.day[infected[infects]] = inf.days[infects]
- V(g)$infector[infected[infects]] = vic
+ V(g)$vic.day[infected] = inf.days[realized]
+ V(g)$infector[infected] = vic
}
}
vic_ids = which(V(g)$vic)
+print(length(vic_ids))
cols = rep('lightblue',N); cols[V(g)$vic]='red'; cols[V(g)$seed]='darkred'
-plot(g, vertex.size=5, vertex.label=NA, vertex.color=cols)
+plot(g, vertex.size=3, vertex.label=NA, vertex.color=cols)
##### generate dag_dat
dag_dat_test = data.frame(matrix(nrow=1,ncol=10))
@@ -68,12 +70,12 @@ rownames(dag_dat_test) = NULL
write.csv(dag_dat_test, file='Results/dag_dat_test.csv')
-##### analyze performance of recovery algorithm
-recovered = read.csv('Results/infectors.csv',header=F,col.names=c('victim','infector'))
-recovered = recovered[order(recovered$victim),]
-infectors = cbind(setdiff(vic_ids,seeds),
- V(g)$infector[setdiff(vic_ids,seeds)],
- recovered$infector[recovered$victim %in% setdiff(vic_ids,seeds)])
-mean(infectors[,2]==infectors[,3])
-
-dag_dat_test[dag_dat_test$to==4984,] \ No newline at end of file
+##### analyze performance of recovery algorithm ------
+# recovered = read.csv('Results/infectors.csv',header=F,col.names=c('victim','infector'))
+# recovered = recovered[order(recovered$victim),]
+# infectors = cbind(setdiff(vic_ids,seeds),
+# V(g)$infector[setdiff(vic_ids,seeds)],
+# recovered$infector[recovered$victim %in% setdiff(vic_ids,seeds)])
+# mean(infectors[,2]==infectors[,3])
+#
+# dag_dat_test[dag_dat_test$to==4984,]
diff --git a/R Scripts/predict-victims-plots.R b/R Scripts/predict-victims-plots.R
index 8a93667..2ac62c8 100644
--- a/R Scripts/predict-victims-plots.R
+++ b/R Scripts/predict-victims-plots.R
@@ -2,7 +2,7 @@
hist(correct_rank3,150,xlim=c(0,vcount(lcc)),col=rgb(0,0,1,1/8),
xlab='Risk Ranking of Victims',main='')
hist(correct_rank1,150,xlim=c(0,vcount(lcc)),col=rgb(1,0,1,1/8),add=T)
-hist(correct_rank2,150,xlim=c(0,vcount(lcc)),col=rgb(1,0,1,1/8),add=T)
+hist(correct_rank2,150,xlim=c(0,vcount(lcc)),col=rgb(0,0,1,1/8),add=T)
legend("topright", c("Demographics Model", "Cascade Model"),
fill=c(rgb(1,0,1,1/8), rgb(0,0,1,1/8)))
@@ -12,9 +12,9 @@ counts = matrix(c(colSums(correct_rank<(vcount(lcc)/1000))*100/nvics,
nrow=3, byrow=T)
plot(lambdas,counts[1,],log='x',type='l')
-correct_rank1 = correct_rank[,length(lambdas)]
-correct_rank2 = correct_rank[,1]
-correct_rank3 = correct_rank[,which.min(colMeans(correct_rank))]
+correct_rank1 = correct_rank[,length(lambdas)] # demographics model
+correct_rank2 = correct_rank[,1] # cascade model
+correct_rank3 = correct_rank[,which.min(colMeans(correct_rank))] # best combined model
counts = matrix(c(sum(correct_rank1<(vcount(lcc)*0.001)),
sum(correct_rank1<(vcount(lcc)*0.005)),
sum(correct_rank1<(vcount(lcc)*0.01)),
@@ -59,3 +59,4 @@ legend("bottomright", inset=0.05,
c("Demographics Model", "Cascade Model", "Combined Model"),
fill=c('red','darkblue','darkgreen'))
lines(c(0,vcount(lcc)),c(0,1))
+
diff --git a/R Scripts/predict-victims.R b/R Scripts/predict-victims.R
index 470815d..2bda7e2 100644
--- a/R Scripts/predict-victims.R
+++ b/R Scripts/predict-victims.R
@@ -1,4 +1,7 @@
library(igraph)
+library(foreach)
+library(doMC)
+registerDoMC(cores=4)
setwd('~/Documents/Cascade Project')
load('Raw Data/lcc.RData')
load('Results/hyper-lcc.RData')
@@ -7,34 +10,36 @@ source('criminal_cascades/R Scripts/temporal.R')
source('criminal_cascades/R Scripts/structural.R')
##### Initialize data
-formula = vic ~ sex + race + age + gang.member + gang.name
+formula = vic ~ sex + race + age + gang.member #+ gang.name
lcc_verts$sex = as.factor(lcc_verts$sex)
lcc_verts$race = as.factor(lcc_verts$race)
lcc_verts$age = as.numeric(lcc_verts$age)
lcc_verts$gang.name = as.factor(lcc_verts$gang.name)
# sum(hyp_lcc_verts$vic)/length(days)
+df = data.frame(ir=lcc_verts$ir_no, dem=0, cas=0, comb=0)
alpha = 0.0028
delta = 0.06
days = sort(unique(hyp_lcc_verts$vic.day)) # 70:max(hyp_lcc_verts$vic.day, na.rm=T)
lambdas = c(0,1)#c(0, exp(seq(log(0.0000001), log(.0005), length.out=150)), 1)
-nvics = sum(lcc_verts$vic)#sum(hyp_lcc_verts$vic.day %in% days)
-correct_rank = matrix(nrow=nvics, ncol=length(lambdas))
+nvics = sum(hyp_lcc_verts$vic.day %in% days)
edges_all = dag_dat_all
##### Loop through days
+writeLines(c(""), "Results/log.txt")
ptm = proc.time()
-for (day in days){
- if (which(day==days) %% 100 == 0) print(day)
-
+correct_rank = foreach (day = days, .combine=rbind) %dopar% {
+ if (which(day==days) %% 100 == 0){sink("Results/log.txt", append=TRUE);cat(paste("day:",day,"\n"))}
+
##### Demographics model
vics = match(unique(hyp_lcc_verts$ir_no[which(hyp_lcc_verts$vic.day<day)]),lcc_verts$name)
victims = lcc_verts[,c('vic','sex','race','age','gang.member','gang.name')]
victims$vic[vics] = TRUE
victims$vic[-vics] = FALSE
-# glm.fit = glm(formula, data=victims, family=binomial)
- glm.fit = lm(formula, data=victims)
- glm.probs = predict(glm.fit, newdata=lcc_verts, type='response')
+ fit = lm(formula, data=victims)
+# fit = glm(formula, data=victims, family=binomial)
+# fit = randomForest(formula, data=victims[,1:5], ntree=100)
+ probs = predict(fit, newdata=lcc_verts, type='response')
##### Cascade Model
edges = edges_all[which(edges_all$t1<day),]
@@ -49,19 +54,21 @@ for (day in days){
# maybe need to change this to reflect new algorithm that accounts for \tilde{p}
##### Combined Model
- combined = data.frame(ir=attr(glm.probs,'name'), dem=as.numeric(glm.probs), cas=0, comb=0)
- combined$cas[match(risk$ir, attr(glm.probs,'name'))] = risk$weight
+ combined = df#data.frame(ir=attr(probs,'name'), dem=as.numeric(probs), cas=0, comb=0)
+ combined$dem[match(attr(probs,'name'), df$ir)] = as.numeric(probs)
+ combined$cas[match(risk$ir, attr(probs,'name'))] = risk$weight
##### Gather results
infected_irs = hyp_lcc_verts$ir_no[which(hyp_lcc_verts$vic.day==day)]
+ crday = matrix(nrow=length(infected_irs), ncol=length(lambdas))
for (lambda in lambdas){
combined$comb = lambda*combined$dem + (1-lambda)*combined$cas
c_idx = which(lambdas==lambda)
- r_idx = head(which(is.na(correct_rank[,c_idx])),length(infected_irs))
- # !! order should be first: rank of (3,5,5,7) should be (1,2,2,4), may need to do n-rank
- correct_rank[r_idx,c_idx] = match(infected_irs, combined$ir[order(combined$comb, decreasing=T)])
- # maybe should also mark down vic/nonvic status of each?
+ crday[,c_idx] = rank(-combined$comb,ties.method='average')[match(infected_irs,combined$ir)]
}
-
+
+ return(crday)
}
print(proc.time()-ptm)
+
+# save(correct_rank, file='Results/correct_rank_62815.RData') \ No newline at end of file
diff --git a/experiments/build_network.py b/experiments/build_network.py
index 0e912b0..2226070 100644
--- a/experiments/build_network.py
+++ b/experiments/build_network.py
@@ -8,6 +8,7 @@ def build_network(filename):
victims = {}
non_victims = {}
age = 0
+ t_max = 1000
with open(filename) as fh:
reader = DictReader(fh)
for row in reader:
@@ -29,7 +30,7 @@ def build_network(filename):
victims[from_] = []
# 'to' is not a victim
else:
- dt = 1000 - int(row["t1"])
+ dt = t_max - int(row["t1"])
parent = (from_, dist, dt, w1, w2, w3)
if to not in non_victims:
# age += 3012 - int(row["spawn2"])
diff --git a/experiments/ml2.so b/experiments/ml2.so
index 515e455..37ff3ea 100755
--- a/experiments/ml2.so
+++ b/experiments/ml2.so
Binary files differ
diff --git a/experiments/out.log b/experiments/out.log
index 6ac961e..98ddbb1 100644
--- a/experiments/out.log
+++ b/experiments/out.log
@@ -1,225 +1,30 @@
-0.0001 0.0001 1e-05 11270 -220027.423471
-0.0001 0.000145977430289 1e-05 11270 -220027.423892
-0.0001 0.000213094101537 1e-05 11270 -220027.424507
-0.0001 0.00031106929352 1e-05 11270 -220027.425405
-0.0001 0.000454090961097 1e-05 11270 -220027.426718
-0.0001 0.000662870316183 1e-05 11270 -220027.42864
-0.0001 0.000967641053709 1e-05 11270 -220027.431456
-0.0001 0.00141253754462 1e-05 11270 -220027.43559
-0.0001 0.0020619860095 1e-05 11270 -220027.441671
-0.0001 0.00301003418958 1e-05 11270 -220027.450652
-0.0001 0.00439397056076 1e-05 11270 -220027.463985
-0.0001 0.00641420531224 1e-05 11270 -220027.483937
-0.0001 0.00936329208824 1e-05 11270 -220027.51414
-0.0001 0.0136682931808 1e-05 11270 -220027.560644
-0.0001 0.0199526231497 1e-05 11270 -220027.63404
-0.000163789370695 0.0001 1e-05 11270 -220027.424054
-0.000163789370695 0.000145977430289 1e-05 11270 -220027.424742
-0.000163789370695 0.000213094101537 1e-05 11270 -220027.425749
-0.000163789370695 0.00031106929352 1e-05 11270 -220027.427219
-0.000163789370695 0.000454090961097 1e-05 11270 -220027.42937
-0.000163789370695 0.000662870316183 1e-05 11270 -220027.432517
-0.000163789370695 0.000967641053709 1e-05 11270 -220027.437127
-0.000163789370695 0.00141253754462 1e-05 11270 -220027.443895
-0.000163789370695 0.0020619860095 1e-05 11270 -220027.453852
-0.000163789370695 0.00301003418958 1e-05 11270 -220027.468555
-0.000163789370695 0.00439397056076 1e-05 11270 -220027.490385
-0.000163789370695 0.00641420531224 1e-05 11270 -220027.523051
-0.000163789370695 0.00936329208824 1e-05 11270 -220027.572501
-0.000163789370695 0.0136682931808 1e-05 11270 -220027.648641
-0.000163789370695 0.0199526231497 1e-05 11270 -220027.76881
-0.000268269579528 0.0001 1e-05 11270 -220027.425007
-0.000268269579528 0.000145977430289 1e-05 11270 -220027.426134
-0.000268269579528 0.000213094101537 1e-05 11270 -220027.427781
-0.000268269579528 0.00031106929352 1e-05 11270 -220027.430188
-0.000268269579528 0.000454090961097 1e-05 11270 -220027.433708
-0.000268269579528 0.000662870316183 1e-05 11270 -220027.438859
-0.000268269579528 0.000967641053709 1e-05 11270 -220027.446406
-0.000268269579528 0.00141253754462 1e-05 11270 -220027.457483
-0.000268269579528 0.0020619860095 1e-05 11270 -220027.473781
-0.000268269579528 0.00301003418958 1e-05 11270 -220027.497849
-0.000268269579528 0.00439397056076 1e-05 11270 -220027.533581
-0.000268269579528 0.00641420531224 1e-05 11270 -220027.58705
-0.000268269579528 0.00936329208824 1e-05 11270 -220027.667993
-0.000268269579528 0.0136682931808 1e-05 11270 -220027.792624
-0.000268269579528 0.0199526231497 1e-05 11270 -220027.989325
-0.000439397056076 0.0001 1e-05 11270 -220027.426565
-0.000439397056076 0.000145977430289 1e-05 11270 -220027.428409
-0.000439397056076 0.000213094101537 1e-05 11270 -220027.431104
-0.000439397056076 0.00031106929352 1e-05 11270 -220027.435043
-0.000439397056076 0.000454090961097 1e-05 11270 -220027.440802
-0.000439397056076 0.000662870316183 1e-05 11270 -220027.44923
-0.000439397056076 0.000967641053709 1e-05 11270 -220027.461579
-0.000439397056076 0.00141253754462 1e-05 11270 -220027.479703
-0.000439397056076 0.0020619860095 1e-05 11270 -220027.506369
-0.000439397056076 0.00301003418958 1e-05 11270 -220027.545748
-0.000439397056076 0.00439397056076 1e-05 11270 -220027.604212
-0.000439397056076 0.00641420531224 1e-05 11270 -220027.691699
-0.000439397056076 0.00936329208824 1e-05 11270 -220027.824138
-0.000439397056076 0.0136682931808 1e-05 11270 -220028.028059
-0.000439397056076 0.0199526231497 1e-05 11270 -220028.349903
-0.000719685673001 0.0001 1e-05 11270 -220027.42911
-0.000719685673001 0.000145977430289 1e-05 11270 -220027.432126
-0.000719685673001 0.000213094101537 1e-05 11270 -220027.436532
-0.000719685673001 0.00031106929352 1e-05 11270 -220027.442972
-0.000719685673001 0.000454090961097 1e-05 11270 -220027.452389
-0.000719685673001 0.000662870316183 1e-05 11270 -220027.46617
-0.000719685673001 0.000967641053709 1e-05 11270 -220027.486361
-0.000719685673001 0.00141253754462 1e-05 11270 -220027.515996
-0.000719685673001 0.0020619860095 1e-05 11270 -220027.559598
-0.000719685673001 0.00301003418958 1e-05 11270 -220027.623986
-0.000719685673001 0.00439397056076 1e-05 11270 -220027.719582
-0.000719685673001 0.00641420531224 1e-05 11270 -220027.862631
-0.000719685673001 0.00936329208824 1e-05 11270 -220028.079185
-0.000719685673001 0.0136682931808 1e-05 11270 -220028.412622
-0.000719685673001 0.0199526231497 1e-05 11270 -220028.938883
-0.00117876863479 0.0001 1e-05 11270 -220027.43326
-0.00117876863479 0.000145977430289 1e-05 11270 -220027.438186
-0.00117876863479 0.000213094101537 1e-05 11270 -220027.445383
-0.00117876863479 0.00031106929352 1e-05 11270 -220027.455901
-0.00117876863479 0.000454090961097 1e-05 11270 -220027.471281
-0.00117876863479 0.000662870316183 1e-05 11270 -220027.49379
-0.00117876863479 0.000967641053709 1e-05 11270 -220027.526769
-0.00117876863479 0.00141253754462 1e-05 11270 -220027.575172
-0.00117876863479 0.0020619860095 1e-05 11270 -220027.646388
-0.00117876863479 0.00301003418958 1e-05 11270 -220027.751556
-0.00117876863479 0.00439397056076 1e-05 11270 -220027.907695
-0.00117876863479 0.00641420531224 1e-05 11270 -220028.141345
-0.00117876863479 0.00936329208824 1e-05 11270 -220028.495054
-0.00117876863479 0.0136682931808 1e-05 11270 -220029.039683
-0.00117876863479 0.0199526231497 1e-05 11270 -220029.899275
-0.00193069772888 0.0001 1e-05 11270 -220027.440007
-0.00193069772888 0.000145977430289 1e-05 11270 -220027.448039
-0.00193069772888 0.000213094101537 1e-05 11270 -220027.459772
-0.00193069772888 0.00031106929352 1e-05 11270 -220027.476921
-0.00193069772888 0.000454090961097 1e-05 11270 -220027.501997
-0.00193069772888 0.000662870316183 1e-05 11270 -220027.538696
-0.00193069772888 0.000967641053709 1e-05 11270 -220027.592466
-0.00193069772888 0.00141253754462 1e-05 11270 -220027.671383
-0.00193069772888 0.0020619860095 1e-05 11270 -220027.787497
-0.00193069772888 0.00301003418958 1e-05 11270 -220027.958967
-0.00193069772888 0.00439397056076 1e-05 11270 -220028.213545
-0.00193069772888 0.00641420531224 1e-05 11270 -220028.594504
-0.00193069772888 0.00936329208824 1e-05 11270 -220029.171224
-0.00193069772888 0.0136682931808 1e-05 11270 -220030.059251
-0.00193069772888 0.0199526231497 1e-05 11270 -220031.46086
-0.00316227766017 0.0001 1e-05 11270 -220027.450926
-0.00316227766017 0.000145977430289 1e-05 11270 -220027.463983
-0.00316227766017 0.000213094101537 1e-05 11270 -220027.483058
-0.00316227766017 0.00031106929352 1e-05 11270 -220027.510937
-0.00316227766017 0.000454090961097 1e-05 11270 -220027.551705
-0.00316227766017 0.000662870316183 1e-05 11270 -220027.611367
-0.00316227766017 0.000967641053709 1e-05 11270 -220027.698782
-0.00316227766017 0.00141253754462 1e-05 11270 -220027.82708
-0.00316227766017 0.0020619860095 1e-05 11270 -220028.015852
-0.00316227766017 0.00301003418958 1e-05 11270 -220028.29462
-0.00316227766017 0.00439397056076 1e-05 11270 -220028.708507
-0.00316227766017 0.00641420531224 1e-05 11270 -220029.32787
-0.00316227766017 0.00936329208824 1e-05 11270 -220030.26552
-0.00316227766017 0.0136682931808 1e-05 11270 -220031.709342
-0.00316227766017 0.0199526231497 1e-05 11270 -220033.988259
-0.00517947467923 0.0001 1e-05 11270 -220027.468461
-0.00517947467923 0.000145977430289 1e-05 11270 -220027.489589
-0.00517947467923 0.000213094101537 1e-05 11270 -220027.520455
-0.00517947467923 0.00031106929352 1e-05 11270 -220027.565567
-0.00517947467923 0.000454090961097 1e-05 11270 -220027.631535
-0.00517947467923 0.000662870316183 1e-05 11270 -220027.728076
-0.00517947467923 0.000967641053709 1e-05 11270 -220027.869527
-0.00517947467923 0.00141253754462 1e-05 11270 -220028.077134
-0.00517947467923 0.0020619860095 1e-05 11270 -220028.382599
-0.00517947467923 0.00301003418958 1e-05 11270 -220028.8337
-0.00517947467923 0.00439397056076 1e-05 11270 -220029.50346
-0.00517947467923 0.00641420531224 1e-05 11270 -220030.50575
-0.00517947467923 0.00936329208824 1e-05 11270 -220032.023162
-0.00517947467923 0.0136682931808 1e-05 11270 -220034.359815
-0.00517947467923 0.0199526231497 1e-05 11270 -220038.048153
-0.00848342898244 0.0001 1e-05 11270 -220027.496279
-0.00848342898244 0.000145977430289 1e-05 11270 -220027.53021
-0.00848342898244 0.000213094101537 1e-05 11270 -220027.579781
-0.00848342898244 0.00031106929352 1e-05 11270 -220027.652231
-0.00848342898244 0.000454090961097 1e-05 11270 -220027.758175
-0.00848342898244 0.000662870316183 1e-05 11270 -220027.913222
-0.00848342898244 0.000967641053709 1e-05 11270 -220028.140396
-0.00848342898244 0.00141253754462 1e-05 11270 -220028.473821
-0.00848342898244 0.0020619860095 1e-05 11270 -220028.964417
-0.00848342898244 0.00301003418958 1e-05 11270 -220029.688926
-0.00848342898244 0.00439397056076 1e-05 11270 -220030.764653
-0.00848342898244 0.00641420531224 1e-05 11270 -220032.374528
-0.00848342898244 0.00936329208824 1e-05 11270 -220034.81191
-0.00848342898244 0.0136682931808 1e-05 11270 -220038.565459
-0.00848342898244 0.0199526231497 1e-05 11270 -220044.490781
-0.0138949549437 0.0001 1e-05 11270 -220027.539544
-0.0138949549437 0.000145977430289 1e-05 11270 -220027.593389
-0.0138949549437 0.000213094101537 1e-05 11270 -220027.672054
-0.0138949549437 0.00031106929352 1e-05 11270 -220027.787023
-0.0138949549437 0.000454090961097 1e-05 11270 -220027.955146
-0.0138949549437 0.000662870316183 1e-05 11270 -220028.201192
-0.0138949549437 0.000967641053709 1e-05 11270 -220028.561701
-0.0138949549437 0.00141253754462 1e-05 11270 -220029.090829
-0.0138949549437 0.0020619860095 1e-05 11270 -220029.869396
-0.0138949549437 0.00301003418958 1e-05 11270 -220031.019211
-0.0138949549437 0.00439397056076 1e-05 11270 -220032.726484
-0.0138949549437 0.00641420531224 1e-05 11270 -220035.28164
-0.0138949549437 0.00936329208824 1e-05 11270 -220039.150477
-0.0138949549437 0.0136682931808 1e-05 11270 -220045.109014
-0.0138949549437 0.0199526231497 1e-05 11270 -220054.516158
-0.0227584592607 0.0001 1e-05 11270 -220027.604764
-0.0227584592607 0.000145977430289 1e-05 11270 -220027.688627
-0.0227584592607 0.000213094101537 1e-05 11270 -220027.811148
-0.0227584592607 0.00031106929352 1e-05 11270 -220027.990215
-0.0227584592607 0.000454090961097 1e-05 11270 -220028.252069
-0.0227584592607 0.000662870316183 1e-05 11270 -220028.635295
-0.0227584592607 0.000967641053709 1e-05 11270 -220029.196809
-0.0227584592607 0.00141253754462 1e-05 11270 -220030.020972
-0.0227584592607 0.0020619860095 1e-05 11270 -220031.233691
-0.0227584592607 0.00301003418958 1e-05 11270 -220033.024747
-0.0227584592607 0.00439397056076 1e-05 11270 -220035.684297
-0.0227584592607 0.00641420531224 1e-05 11270 -220039.664958
-0.0227584592607 0.00936329208824 1e-05 11270 -220045.692799
-0.0227584592607 0.0136682931808 1e-05 11270 -220054.977676
-0.0227584592607 0.0199526231497 1e-05 11270 -220069.638543
-0.0372759372031 0.0001 1e-05 11270 -220027.698422
-0.0372759372031 0.000145977430289 1e-05 11270 -220027.825392
-0.0372759372031 0.000213094101537 1e-05 11270 -220028.010892
-0.0372759372031 0.00031106929352 1e-05 11270 -220028.282006
-0.0372759372031 0.000454090961097 1e-05 11270 -220028.678468
-0.0372759372031 0.000662870316183 1e-05 11270 -220029.258698
-0.0372759372031 0.000967641053709 1e-05 11270 -220030.108881
-0.0372759372031 0.00141253754462 1e-05 11270 -220031.35677
-0.0372759372031 0.0020619860095 1e-05 11270 -220033.193044
-0.0372759372031 0.00301003418958 1e-05 11270 -220035.905157
-0.0372759372031 0.00439397056076 1e-05 11270 -220039.932658
-0.0372759372031 0.00641420531224 1e-05 11270 -220045.961343
-0.0372759372031 0.00936329208824 1e-05 11270 -220055.091575
-0.0372759372031 0.0136682931808 1e-05 11270 -220069.157308
-0.0372759372031 0.0199526231497 1e-05 11270 -220091.371085
-0.0610540229659 0.0001 1e-05 11270 -220027.823505
-0.0610540229659 0.000145977430289 1e-05 11270 -220028.008048
-0.0610540229659 0.000213094101537 1e-05 11270 -220028.277661
-0.0610540229659 0.00031106929352 1e-05 11270 -220028.671711
-0.0610540229659 0.000454090961097 1e-05 11270 -220029.247951
-0.0610540229659 0.000662870316183 1e-05 11270 -220030.091301
-0.0610540229659 0.000967641053709 1e-05 11270 -220031.327042
-0.0610540229659 0.00141253754462 1e-05 11270 -220033.140891
-0.0610540229659 0.0020619860095 1e-05 11270 -220035.810071
-0.0610540229659 0.00301003418958 1e-05 11270 -220039.752546
-0.0610540229659 0.00439397056076 1e-05 11270 -220045.607535
-0.0610540229659 0.00641420531224 1e-05 11270 -220054.372543
-0.0610540229659 0.00936329208824 1e-05 11270 -220067.648403
-0.0610540229659 0.0136682931808 1e-05 11270 -220088.103672
-0.0610540229659 0.0199526231497 1e-05 11270 -220120.413364
-0.1 0.0001 1e-05 11270 -220027.97435
-0.1 0.000145977430289 1e-05 11270 -220028.228322
-0.1 0.000213094101537 1e-05 11270 -220028.599372
-0.1 0.00031106929352 1e-05 11270 -220029.141677
-0.1 0.000454090961097 1e-05 11270 -220029.934723
-0.1 0.000662870316183 1e-05 11270 -220031.095385
-0.1 0.000967641053709 1e-05 11270 -220032.796098
-0.1 0.00141253754462 1e-05 11270 -220035.292484
-0.1 0.0020619860095 1e-05 11270 -220038.966138
-0.1 0.00301003418958 1e-05 11270 -220044.392434
-0.1 0.00439397056076 1e-05 11270 -220052.451402
-0.1 0.00641420531224 1e-05 11270 -220064.51647
-0.1 0.00936329208824 1e-05 11270 -220082.791961
-0.1 0.0136682931808 1e-05 11270 -220110.952545
-0.1 0.0199526231497 1e-05 11270 -220155.435246
+0.15 0.08 0.1 47 -9267.41771294
+0.15 0.09 0.1 47 -9252.48080998
+0.15 0.1 0.1 47 -9284.46218119
+0.16 0.08 0.1 47 -9264.20398958
+0.16 0.09 0.1 47 -9248.68415885
+0.16 0.1 0.1 47 -9280.20703963
+0.17 0.08 0.1 47 -9262.86382359
+0.17 0.09 0.1 47 -9246.64573861
+0.17 0.1 0.1 47 -9278.035135
+0.18 0.08 0.1 47 -9263.17461439
+0.18 0.09 0.1 47 -9246.47738823
+0.18 0.1 0.1 47 -9276.64980284
+0.19 0.08 0.1 47 -9264.88048993
+0.19 0.09 0.1 47 -9246.9887665
+0.19 0.1 0.1 47 -9276.34422971
+0.2 0.08 0.1 47 -9267.64171914
+0.2 0.09 0.1 47 -9248.12259288
+0.2 0.1 0.1 47 -9276.81325712
+0.21 0.08 0.1 47 -9270.44267951
+0.21 0.09 0.1 47 -9249.95231714
+0.21 0.1 0.1 47 -9277.29709878
+0.22 0.08 0.1 47 -9273.93909307
+0.22 0.09 0.1 47 -9252.08035758
+0.22 0.1 0.1 47 -9279.14946242
+0.23 0.08 0.1 47 -9277.80574763
+0.23 0.09 0.1 47 -9255.27746396
+0.23 0.1 0.1 47 -9281.37029413
+0.24 0.08 0.1 47 -9282.57182493
+0.24 0.09 0.1 47 -9258.93035339
+0.24 0.1 0.1 47 -9284.2416322
diff --git a/experiments/process.py b/experiments/process.py
index f31e0d4..0115bd4 100644
--- a/experiments/process.py
+++ b/experiments/process.py
@@ -15,30 +15,30 @@ if __name__ == "__main__":
sys.exit("usage: {0} <file>".format(sys.argv[0]))
root_victims, victims, non_victims, age = load(open(sys.argv[1]))
- # alphas = np.arange(1e-3, 1e-2, 8e-4) # parameter of the time component
- alphas = np.logspace(-4,-1,num=15)
- # deltas = np.arange(0.001, 0.3, 0.008) # parameter of the structural component
- deltas = np.logspace(-4,-1.7,num=15)
- with open("out.log", "w") as fh:
- for alpha, delta in product(alphas, deltas):
- beta, roots, ll = ml3(root_victims, victims, non_victims, age, alpha, delta)
- print "\t".join(map(str, [alpha, delta, beta, roots, ll]))
- fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n")
- fh.flush()
-
- # alphas = np.arange(.04, .075, .003) # parameter of the time component
- # # alphas = np.logspace(-4,-1,num=20)
- # deltas = np.arange(.07, .11, .003) # parameter of the structural component
- # # deltas = np.logspace(-2,-.5,num=20)
- # lmbda = 0.10#np.logspace(-12,-3,num=10)
+ # # alphas = np.arange(1e-3, 1e-2, 8e-4) # parameter of the time component
+ # alphas = np.logspace(-4,-1,num=15)
+ # # deltas = np.arange(0.001, 0.3, 0.008) # parameter of the structural component
+ # deltas = np.logspace(-4,-1.7,num=15)
# with open("out.log", "w") as fh:
# for alpha, delta in product(alphas, deltas):
- # lmbda, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, lmbda)
- # print "\t".join(map(str, [alpha, delta, lmbda, roots, ll]))
- # fh.write("\t".join(map(str, [alpha, delta, lmbda, roots, ll])) + "\n")
+ # beta, roots, ll = ml3(root_victims, victims, non_victims, age, alpha, delta)
+ # print "\t".join(map(str, [alpha, delta, beta, roots, ll]))
+ # fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n")
# fh.flush()
- # alpha = 0.061
- # delta = 0.082
+ alphas = np.arange(.15, .25, .01) # parameter of the time component
+ # alphas = np.logspace(-4,-.5,num=15)
+ deltas = np.arange(.08, .1, .01) # parameter of the structural component
+ # deltas = np.logspace(-2,-.1,num=15)
+ lmbda = 0.10#np.logspace(-12,-3,num=10)
+ with open("out.log", "w") as fh:
+ for alpha, delta in product(alphas, deltas):
+ lmbda, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, lmbda)
+ print "\t".join(map(str, [alpha, delta, lmbda, roots, ll]))
+ fh.write("\t".join(map(str, [alpha, delta, lmbda, roots, ll])) + "\n")
+ fh.flush()
+
+ # alpha = .016
+ # delta = 0.077
# beta, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, 1.)
# print "\t".join(map(str, [alpha, delta, beta, roots, ll])) \ No newline at end of file