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
| #!/usr/bin/env python | |
| #-*-coding:utf-8-*- | |
| import argparse | |
| # args | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('text') | |
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(randomForest) | |
| # load data | |
| data = read.delim("data/sample.tsv", sep="\t") | |
| # create data for k-fold cross validation | |
| cv = function(d, k) { | |
| n = sample(nrow(d), nrow(d)) | |
| d.randomized = data[n,] # randomize data | |
| n.residual = k-nrow(d)%%k |
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(xgboost) | |
| library(Matrix) | |
| # load data | |
| data = read.delim("data/sample.tsv", sep="\t") | |
| data$v6 = NULL | |
| # create data for k-fold cross validation | |
| cv = function(d, k) { | |
| n = sample(nrow(d), nrow(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
| <?php | |
| $hosts = array('slave_host01', 'slave_host02', 'slave_host03'); | |
| foreach ($hosts as $host) { | |
| exec("ssh $host /usr/java/default/bin/jps | /bin/grep 'DataNode\|TaskTracker' | /bin/sed 's/\([0-9]\) .*/\1/'", $pids); | |
| foreach ($pids as $pid) { | |
| exec("ssh $host kill $pid); | |
| } | |
| } |
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 data | |
| data <- read.delim(testadata.txt") | |
| # execute regression and plot confidence/predict interval | |
| predict_continue <- function(target_method, target_cpa, interval) { | |
| d <- subset(data, method==target) | |
| # regression using log() transformation | |
| d.lm <- lm(continue~log(month)+cpa, data=d) | |
| summary(d.lm) | |
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
| source("http://aoki2.si.gunma-u.ac.jp/R/src/pairwise.prop2.test.R", encoding="euc-jp") | |
| x <- matrix(c(18, 82, 40, 76, 32, 52), ncol=2, byrow=T) | |
| x | |
| chisq.test(x) | |
| fisher.test(x) | |
| pairwise.prop2.test(x, p.adjust.method="holm", test.function=chisq.test) |
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
| x <- matrix(c(1, 1, 1, 1, 1, 1, 3, 7, 1, 5, 4, 2), 6, 2) #素性ベクトル | |
| l <- c(-1, 1, -1, 1, 1, -1) #ラベル | |
| w <- c(0, 0) #重みベクトル | |
| r <- 0.5 #学習係数 | |
| #重みベクトルの更新メソッド | |
| update <- function(x, l, w) { | |
| if (sign(x %*% w) == sign(l)) { | |
| return(w) | |
| } |
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
| #パラメタ | |
| x <- matrix(c(1, 1, 1, 1, 1, 1, 3, 7, 1, 5, 4, 2), 6, 2) #素性ベクトル | |
| l <- c(-1, 1, -1, 1, 1, -1) #ラベル | |
| w <- c(0, 0) #重みベクトル | |
| r <- 0.5 #学習係数 | |
| #重みベクトルの更新メソッド | |
| update <- function(x, l, w) { | |
| if (sign(x %*% w) == sign(l)) { | |
| return(w) |
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
| team team_no number era game win lose winning_rate WHIP DIPS | |
| giants 1 19 3.12 27 13 6 0.684 1.15 2.81 | |
| giants 1 26 3.31 25 13 6 0.684 1.27 3.65 | |
| giants 1 15 3.13 34 5 10 0.333 1.14 3.64 | |
| giants 1 18 3.35 24 11 6 0.647 1.12 3.87 | |
| tigers 2 54 2.89 30 12 8 0.6 1.17 3.03 | |
| tigers 2 14 2.69 25 11 7 0.611 1.08 3.67 | |
| tigers 2 55 2.74 26 8 12 0.4 1.29 3.46 | |
| curp 3 18 2.1 26 15 7 0.682 0.96 2.98 | |
| curp 3 42 3.23 28 11 9 0.55 1.13 3.97 |
OlderNewer