-- database
select
datname
,HAS_DATABASE_PRIVILEGE(datname, 'create') as create
This file contains hidden or 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("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) |
This file contains hidden or 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
# 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 |
※これはVOYAGE GROUP エンジニアブログ:Advent Calendar 2014の3日目の記事です。
もうこんな季節なんですね。 去年のエントリから1年経ってると思うとホントにあっという間にでした!
弊社では、運用しているメディアサービスのデータ解析環境としてDWH(データウェアハウス)製品のひとつであるPureData(IBM PureData for Analytics)を使っていたりします。 Amazon RedshiftやGoogle BigQuery などのクラウドサービスもあったりするので高性能なシステムでの分析ができる機会は増えてくるのかなと思います。
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
This file contains hidden or 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
# 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) |
This file contains hidden or 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
# -*- 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): |
This file contains hidden or 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
import datetime | |
import calendar | |
def lastday_of_month(date): | |
y = date.year | |
m = date.month | |
last_d = calendar.monthrange(y, m)[1] | |
return date.replace(day=last_d) |
This file contains hidden or 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
bind.params<-function(txt.template,...){ | |
require("dplyr") | |
loop.cnt <- | |
txt.template %>% | |
strsplit(.,"") %>% | |
unlist %in% | |
c('?') %>% | |
which %>% | |
length | |
res <- txt.template |
This file contains hidden or 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('RUnit') | |
source('./mysum.r') | |
# refs | |
# - http://cran.r-project.org/web/packages/RUnit/RUnit.pdf | |
# - http://www.okada.jp.org/RWiki/?RUnit%20%A4%F2%BB%C8%A4%A6 | |
test.mysum <- function(){ | |
checkEqualsNumeric(mysum(1:10),55) | |
} |