mysql -uroot -e 'select now(),date(now())' | cat > /tmp/out.txt
more /tmp/out.txt
- 結果
now() date(now())
2014-10-06 19:13:44 2014-10-06
# -*- coding: utf-8 -*- | |
# http://docs.python.jp/2/library/unittest.html | |
# https://pypi.python.org/pypi/pyrg | |
import random | |
import unittest | |
class TestSequenceFunctions(unittest.TestCase): |
# http://docs.ggplot2.org/current/theme.html | |
# http://docs.ggplot2.org/current/scale_date.html | |
a <- AirPassengers | |
ap.df <- data.frame( | |
year=seq(from=as.Date("1949-01-01"),to=as.Date("1960-12-01"),by="1 month"), | |
passengers=as.numeric(a) | |
) | |
p <- qplot(data=ap.df,x=year,y=passengers)+geom_line()+scale_x_date(labels = date_format("%Y/%m/%d")) | |
print(p) |
mysql -uroot -e 'select now(),date(now())' | cat > /tmp/out.txt
more /tmp/out.txt
now() date(now())
2014-10-06 19:13:44 2014-10-06
※これはVOYAGE GROUP エンジニアブログ:Advent Calendar 2014の3日目の記事です。
もうこんな季節なんですね。 去年のエントリから1年経ってると思うとホントにあっという間にでした!
弊社では、運用しているメディアサービスのデータ解析環境としてDWH(データウェアハウス)製品のひとつであるPureData(IBM PureData for Analytics)を使っていたりします。 Amazon RedshiftやGoogle BigQuery などのクラウドサービスもあったりするので高性能なシステムでの分析ができる機会は増えてくるのかなと思います。
-- database
select
datname
,HAS_DATABASE_PRIVILEGE(datname, 'create') as create
# p.120 | |
logistic <- function(z){ | |
1 / (1+exp(-z)) | |
} | |
# z <- seq(-6,6,0.1) | |
# plot(z,logistic(z),type="l") | |
x <- seq(-3,3,0.1) | |
z <- function(x,b_1,b_2){ | |
# z = b_1 + b_2*x |
library("magrittr") | |
library("dplyr") | |
library("ggplot2") | |
# midori_study 7 | |
# http://hosho.ees.hokudai.ac.jp/~kubo/ce/IwanamiBook.html | |
rsc.dir <- "~/workspace/kubo_midori_7/" | |
d <- paste0(rsc.dir,"data.csv") %>% read.csv | |
head(d) |
library("ggplot2") | |
library("magrittr") | |
library("dplyr") | |
# midori 8 | |
# http://hosho.ees.hokudai.ac.jp/~kubo/ce/IwanamiBook.html | |
data <- c(4,3,4,5,5,2,3,1,4,0,1,5,5,6,5,4,4,5,3,4) | |
hist(data) | |
loglik <- function(q){ |
# rcpp sandbox | |
gibbs_r <- function(n,thin){ | |
# R実装のギブスサンプラー | |
mat <- matrix(0,nrow=n,ncol=2) | |
x <- 0 | |
y <- 0 | |
for(i in 1:n){ | |
for(j in 1:thin){ | |
x <- rgamma(1, 3, 1/(y*y+4) ) |
library("magrittr") | |
library("dplyr") | |
data(Titanic) | |
t <- Titanic %>% as.data.frame %>% arrange(Survived,Class,Sex,Age) | |
t %>% | |
group_by(Survived) %>% | |
summarize(ClassCount=sum(Freq)) %>% | |
group_by %>% |