This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// deep joins are easy using scoobi. | |
// for instance if you have a function that computes your most frequent queries in hadoop and you want to | |
// return only the search session objects (which could have tons of event data other than searches) | |
// that contain at least one of those queries you can do it like this. | |
val sessions_w_pop_queries = listOfPopQueries.join(sessions).filter { | |
case (pop_queries, session) => session.justSearchPages.flatMap { _.keyword }.toSet.intersect(pop_queries).nonEmpty | |
}.map { case (pop_queries, session) => session } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
K <- 500 | |
N <- 10000 | |
# sort the normal random variable this help to see clearly that stream | |
# sampling does not care which observations come first | |
data <- sort(rnorm(N)) | |
res <- numeric(0) | |
for (i in 1:K) { | |
res <- c(res, data[i]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkgs <- c( | |
"data.table", | |
"ggplot2", | |
"scales", | |
"googleVis", | |
"igraph", | |
"gplots", | |
"ROCR", | |
"knitr", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(x <- 1 to 2 ; y <- 3 to 4 ; z<- 5 to 6 ) println(x,y,z) | |
(1,3,5) | |
(1,3,6) | |
(1,4,5) | |
(1,4,6) | |
(2,3,5) | |
(2,3,6) | |
(2,4,5) | |
(2,4,6) |