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
val currentWindowHandle = driver.getWindowHandle() | |
val windowHandles = driver.getWindowHandles() | |
windowHandles.remove(currentWindowHandle) | |
driver.switchTo().window(windowHandles.iterator().next()) |
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
library(kohonen) | |
out.som <- som(scale(data), grid=somgrid(3,3,"rect"), rlen=1000) | |
plot(out.som, type="changes") | |
plot(out.som, type="counts") | |
if(ncol(out.som$codes) > 14) { | |
out.som$codes <- out.som$codes[, sort(names(rev(sort(apply(out.som$codes, 2, var)))[1:14]))] | |
} | |
plot(out.som, type="code", palette.name=rainbow) |
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
model{ | |
for(i in 1:N) | |
y[i] ~ normal(alpha + beta * x[i], s); | |
s ~ inv_gamma(0.001, 0.001); | |
} |
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
list_funcs <- function(file) { | |
Filter(function(expr) { | |
expr <- as.character(expr) | |
length(expr) == 3 && substring(expr[3], 1, 9) == "function(" | |
}, as.list(parse(file))) | |
} |
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
library(animation) | |
library(ggplot2) | |
library(gridExtra) | |
xlim <- xlim(-0.5, 20.5) | |
saveGIF({ | |
g_nbiom <- qplot(x=NULL, y=NULL) + | |
geom_bar(stat="identity") + xlim + ylim(0, 1) + | |
theme(axis.text.y=element_blank()) + xlab("負の二項分布") + ylab("") |
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
library(miniCRAN) | |
dir.create("miniCRAN") | |
packages <- c("dplyr", "ggplot2", "tidyr", "mclust", "Matching", "knitr", | |
"devtools", "roxygen2", "data.table", "rmarkdown", "shiny", | |
"mice", "formattable", "deal", "DMwR", "discretization", "loo", | |
"ROCR", "DiagrammeR", "rJava", "testthat", "VennDiagram", "venneuler", | |
"glmnet", "bit64", "lubridate", "Nippon", "useful", "densratio", | |
"gridExtra", "ggfortify", "partykit", "tree", "rstan", "loo", "shinystan", |
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
prophet_shf <- function(model, periods, freq = "d", k = 3) { | |
N <- nrow(model$history) | |
if (periods %% 2 == 1) periods <- periods + 1 | |
preserve <- (k + 1) * periods / 2 | |
n_history <- N - preserve - 1 | |
if (n_history < periods * 2) warning("History is too short.") | |
result <- data.frame() | |
while (n_history < N - periods) { | |
data_hist <- head(model$history, n_history) | |
m <- prophet(data_hist, growth = model$growth, |
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
insert_data_frame <- function(df, df_added, col) | |
{ | |
index <- which(col == names(df)) | |
data.frame(append(df, list(df_added = df_added), index))[, -index] | |
} |
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
f <- function(X) { | |
X <- as.matrix(X) | |
limit <- qchisq(0.5, df = ncol(X)) | |
apply(X, 1, function(row) { | |
if(sum(row^2) > limit) 1 else -1 | |
}) | |
} | |
D <- 2 |
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
f <- function(X) { | |
X <- as.matrix(X) | |
limit <- qchisq(0.5, df = ncol(X)) | |
apply(X, 1, function(row) { | |
if(sum(row^2) > limit) 1 else -1 | |
}) | |
} | |
D <- 2 | |
M <- 2200 |
OlderNewer