会社でhudsonを使っていて、そろそろプラグインが書きたくなったので、
休みを利用して調べもの。
公式にある記事だと、何かの作業を実施後みたいで、
それだけをやるとファイルが足りんぞ!と怒られた。
で、他のも見に行ってみると、これが正解だった。
1. まずは以下のリンク先から必要なのを取得
https://hudson.dev.java.net/source/browse/*checkout*/hudson/trunk/hudson/tools/bootstrap/pom.xml
2. その後、バージョンの指定を付けずに、mvn hpi:create
ここでも、必要なのを自動ダウンロードしてくれた。
最後に、artifactIdを聞かれるので、適当に入力をして、準備完了。
下の記事のようにバージョンを指定してしまうと、記事が2008年なんで
ファイルが見つからんわーーとなるので、指定しないほうがいいみたい。
参考にした記事:
http://d.hatena.ne.jp/cactusman/20080518/p1
2009年9月21日月曜日
2009年9月12日土曜日
sqlite + swig?
sqlite3-rubyをインストールし直してたんですが、
なんでか未定義エラーが出まくってた。
んー??と調べてみたところ、swigが必要とか情報発見。
http://gendosu.ddo.jp/redmine/projects/1/wiki/SQLite
確かに、snow leopard入れた際に、portの中身をいっさい消したけど、
こんなところに影響でるんかい。
素直に、gem installで、エラーを吐いてくれた方がいいような気がするけど。
なんでか未定義エラーが出まくってた。
んー??と調べてみたところ、swigが必要とか情報発見。
http://gendosu.ddo.jp/redmine/projects/1/wiki/SQLite
確かに、snow leopard入れた際に、portの中身をいっさい消したけど、
こんなところに影響でるんかい。
素直に、gem installで、エラーを吐いてくれた方がいいような気がするけど。
2009年9月1日火曜日
2009年8月14日金曜日
GMMAチャート改良版


下手なコードだな-.... orz
GMMA <- function(code, start, end) {
library("quantmod")
ss <- paste(start, end,sep="::")
fn <- paste("~/repo/yahoo/", code, ".csv", sep="")
# データの読み込み
data <- read.zoo(fn, header=T, sep=",")
fn2 <- paste("~/repo/jpg/", code, ".jpg", sep="")
jpeg(fn2, width=640,height=480)
t <- paste("GMMA(", code, ")", "- (Short(red), Long(blue))")
# subsetで表示範囲を指定
candleChart(
data,
name = t,
theme = chartTheme("white"),
TA="addVo();
addEMA(3,col='red');
addEMA(5,col='red');
addEMA(8,col='red');
addEMA(10,col='red');
addEMA(12,col='red');
addEMA(15,col='red');
addEMA(30);
addEMA(35);
addEMA(40);
addEMA(45);
addEMA(50);
addEMA(60)",
subset=ss)
dev.off()
}
2009年8月13日木曜日
ナイーブベイズ
パッケージ 'e1071'をインストールすればOK.
それ以外のパッケージについては、以下のリンク。
http://cran.r-project.org/web/views/Bayesian.html
日本語の教科書が欲しい。
naiveBayes {e1071} R Documentation
Naive Bayes Classifier
Description
Computes the conditional a-posterior probabilities of a categorical class variable given independent predictor variables using the Bayes rule.
Usage
## S3 method for class 'formula':
naiveBayes(formula, data, laplace = 0, ..., subset, na.action = na.pass)
## Default S3 method:
naiveBayes(x, y, laplace = 0, ...)
## S3 method for class 'naiveBayes':
predict(object, newdata,
type = c("class", "raw"), threshold = 0.001, ...)
Arguments
x A numeric matrix, or a data frame of categorical and/or numeric variables.
y Class vector.
formula A formula of the form class ~ x1 + x2 + .... Interactions are not allowed.
data Either a data frame of predictors (caegorical and/or numeric) or a contingency table.
laplace positive double controlling Laplace smoothing. The default (0) disables Laplace smoothing.
... Currently not used.
subset For data given in a data frame, an index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.)
na.action A function to specify the action to be taken if NAs are found. The default action is not to count them for the computation of the probability factors. An alternative is na.omit, which leads to rejection of cases with missing values on any required variable. (NOTE: If given, this argument must be named.)
object An object of class "naiveBayes".
newdata A dataframe with new predictors.
type If "raw", the conditional a-posterior probabilities for each class are returned, and the class with maximal probability else.
threshold Value replacing cells with 0 probabilities.
Details
The standard naive Bayes classifier (at least this implementation) assumes independence of the predictor variables, and Gaussian distribution (given the target class) of metric predictors. For attributes with missing values, the corresponding table entries are omitted for prediction.
Value
An object of class "naiveBayes" including components:
apriori Class distribution for the dependent variable.
tables A list of tables, one for each predictor variable. For each categorical variable a table giving, for each attribute level, the conditional probabilities given the target class. For each numeric variable, a table giving, for each target class, mean and standard deviation of the (sub-)variable.
Author(s)
David Meyer David.Meyer@R-project.org. Laplace smoothing enhancement by Jinghao Xue.
Examples
## Categorical data only:
data(HouseVotes84, package="mlbench")
model <- naiveBayes(Class ~ ., data = HouseVotes84)
predict(model, HouseVotes84[1:10,-1])
predict(model, HouseVotes84[1:10,-1], type = "raw")
pred <- predict(model, HouseVotes84[,-1])
table(pred, HouseVotes84$Class)
## using laplace smoothing:
model <- naiveBayes(Class ~ ., data = HouseVotes84, laplace = 3)
pred <- predict(model, HouseVotes84[,-1])
table(pred, HouseVotes84$Class)
## Example of using a contingency table:
data(Titanic)
m <- naiveBayes(Survived ~ ., data = Titanic)
m
predict(m, as.data.frame(Titanic)[,1:3])
## Example with metric predictors:
data(iris)
m <- naiveBayes(Species ~ ., data = iris)
## alternatively:
m <- naiveBayes(iris[,-5], iris[,5])
m
table(predict(m, iris[,-5]), iris[,5])
[Package e1071 version 1.5-19 Index]
それ以外のパッケージについては、以下のリンク。
http://cran.r-project.org/web/views/Bayesian.html
日本語の教科書が欲しい。
naiveBayes {e1071} R Documentation
Naive Bayes Classifier
Description
Computes the conditional a-posterior probabilities of a categorical class variable given independent predictor variables using the Bayes rule.
Usage
## S3 method for class 'formula':
naiveBayes(formula, data, laplace = 0, ..., subset, na.action = na.pass)
## Default S3 method:
naiveBayes(x, y, laplace = 0, ...)
## S3 method for class 'naiveBayes':
predict(object, newdata,
type = c("class", "raw"), threshold = 0.001, ...)
Arguments
x A numeric matrix, or a data frame of categorical and/or numeric variables.
y Class vector.
formula A formula of the form class ~ x1 + x2 + .... Interactions are not allowed.
data Either a data frame of predictors (caegorical and/or numeric) or a contingency table.
laplace positive double controlling Laplace smoothing. The default (0) disables Laplace smoothing.
... Currently not used.
subset For data given in a data frame, an index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.)
na.action A function to specify the action to be taken if NAs are found. The default action is not to count them for the computation of the probability factors. An alternative is na.omit, which leads to rejection of cases with missing values on any required variable. (NOTE: If given, this argument must be named.)
object An object of class "naiveBayes".
newdata A dataframe with new predictors.
type If "raw", the conditional a-posterior probabilities for each class are returned, and the class with maximal probability else.
threshold Value replacing cells with 0 probabilities.
Details
The standard naive Bayes classifier (at least this implementation) assumes independence of the predictor variables, and Gaussian distribution (given the target class) of metric predictors. For attributes with missing values, the corresponding table entries are omitted for prediction.
Value
An object of class "naiveBayes" including components:
apriori Class distribution for the dependent variable.
tables A list of tables, one for each predictor variable. For each categorical variable a table giving, for each attribute level, the conditional probabilities given the target class. For each numeric variable, a table giving, for each target class, mean and standard deviation of the (sub-)variable.
Author(s)
David Meyer David.Meyer@R-project.org. Laplace smoothing enhancement by Jinghao Xue.
Examples
## Categorical data only:
data(HouseVotes84, package="mlbench")
model <- naiveBayes(Class ~ ., data = HouseVotes84)
predict(model, HouseVotes84[1:10,-1])
predict(model, HouseVotes84[1:10,-1], type = "raw")
pred <- predict(model, HouseVotes84[,-1])
table(pred, HouseVotes84$Class)
## using laplace smoothing:
model <- naiveBayes(Class ~ ., data = HouseVotes84, laplace = 3)
pred <- predict(model, HouseVotes84[,-1])
table(pred, HouseVotes84$Class)
## Example of using a contingency table:
data(Titanic)
m <- naiveBayes(Survived ~ ., data = Titanic)
m
predict(m, as.data.frame(Titanic)[,1:3])
## Example with metric predictors:
data(iris)
m <- naiveBayes(Species ~ ., data = iris)
## alternatively:
m <- naiveBayes(iris[,-5], iris[,5])
m
table(predict(m, iris[,-5]), iris[,5])
[Package e1071 version 1.5-19 Index]
登録:
投稿 (Atom)