2013-01-01から1年間の記事一覧
From http://blog.mizoshiri.com/archives/166 # yum -y install mysql-server Change the character sets datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Default to using old password format for compatibility with mysql 3.x # clients (…
Ruby which can be installed by yum is 1.8.x for CentOS 6.4. So, we install ruby 1.9.x from sources. 1. Install epel. Epel is is Extra Packages for Enterprise Linux. rpm -ivh epel-release-5-4.noarch.rpm http://www.tooyama.org/yum-addrepo-ep…
20を4に置き換える。 match が b match であり,b.match でないことに注意 scala> a res9: Array[Int] = Array(1, 20, 20, 30, 40, 50) scala> a.map{i=> i match{case 20 => 4;case _ => i;}}; res10: Array[Int] = Array(1, 4, 4, 30, 40, 50)
var a=List(1,2,3,4); var v=List(2,3,4,5); a.zip(v).map{i=> i._1*i._2;}.sum res15: Int = 40
まず、mysqlを導入. apt_cygのインストール http://d.hatena.ne.jp/vivid_skid/20120702/1341197890 wget.exe http://apt-cyg.googlecode.com/svn/trunk/apt-cyg mv apt-cyg /bin/ chmod.exr +x /bin/apt-cyg 次にmysqlをとってくる http://takuya-1st.hate…
http://www.wolframalpha.com/input/?i=int%5Blog%28x%29*x%5E%28-alpha%29%2Cx%5D 0=+C Robust parameter estimation with a small bias against heavy contamination Hironori Fujisawa, , Shinto Eguchi http://www.sciencedirect.com/science/article/pi…
ポアソン分布の差分の分布. Skellam distribution http://en.wikipedia.org/wiki/Skellam_distribution #library(skellam) library(VGAM) v1<-rpois(100000,lambda=1.3) v2<-rpois(100000,lambda=2.2) q<-v2-v1 x<-as.numeric(names(table(q))) #PDF plot(x…
http://monoist.atmarkit.co.jp/mn/articles/1206/06/news007.html http://monoist.atmarkit.co.jp/mn/articles/1008/30/news100.html モノづくりは科学とは違います。理論の解明が目的ではありません。モノづくりには、理論より具体的な手段の創造が必要と…
Rで線形近似 x<-1:10 y<-x^2 plot(x,y) points(x,predict(lm(x~y)),col=2)
[1]平滑化スプライン法と平滑化のまとめ http://www.stat.math.keio.ac.jp/under.grad/data.analysis/2010/lecture/DS_Lec9_20101213.pdfroughness penalty)[2]Bスプラインと情報量基準 http://www.ism.ac.jp/editsec/toukei/pdf/47-2-359.pdf [2]p362の2.6…
Kleinbergのバースト解析アルゴリズム package bursts http://cran.r-project.org/web/packages/bursts/bursts.pdf burst detection algorithmマニュアルより offsets <- c(seq(0, 400, 100), seq(410, 450, 5), seq(451, 470, 2),seq(480, 600, 5), 700, se…
qq00b<-as.integer(gsub("_s.csv","",qq0))
import org.apache.commons.math3.distribution.NormalDistribution import org.apache.commons.math3.distribution.PoissonDistribution object test{ def main(args:Array[String])={ var norm=new NormalDistribution(1.0,0.5); println(norm.cumulativeP…
java.nio.charset.UnmappableCharacterException: Input length = 2 対策 cygwinでjava(scala)の利用,文字化け,文字コードエラー対策 こんな感じ J-Dfile.encoding=UTF-8 scala -J-Dfile.encoding=UTF-8 -J-Xmx1g xxxx.scala ~/.bashrc に以下のようにエ…
rubyで日付っぽい文字列を出力%記号を使うと書式付の出力ができる. 12.times{|j| 31.times{|i| puts "%02d"%(j+1)+"%02d"%(i+1) } } 参考 http://doc.ruby-lang.org/ja/2.0.0/method/String/i/=25.html 参考 http://d.hatena.ne.jp/xibbar/20090917#1253108…
import scala.collection.mutable.ArrayBuffer import scala.math._ object test5{ def main(args:Array[String]) ={ var a=new ArrayBuffer[Int]; Math.pow(10,3); (0 to 3).foreach{i=> (1 to 9).foreach{j=> a+=(j*(Math.pow(10,i))).toInt } } a+=10000 …
scalaでランク関数(順位づけ). (重複データはないとする) qq_rank=qq.map{a=> qq.filter(_>=a).length}
配列を要素とするMapに値をつめていく。qqにb(1)をキーに配列としてつめる。 var qq=Map[String,ArrayBuffer[float]]() qq.update(b(1),qq.getOrElse(b(1),ArrayBuffer [Float]())+=n);
Rで条件付きパーセンタイル解析>> wakekijyun_d function (x, y, kugiri = 32, minmin = 1, last = F,points=F,pch=1,xlab="x",ylab="y"){ d st fi if (minmin != 1) { length2 for (i in 1:length(st)) { xb2 = st[i] & x length2[i] } f12345 = minmin))) …
シェルスクリプトで連番ファイルから抜けているものをさがす 1.csv 2.csv … ls | grep -v name |grep csv | sort -gr | sed "s/.csv//g" | awk '{print $1,$1-tmp;tmp=$1}' | awk '$2!=-1{for(i=1;i<-$2;i++){print $1+i}}'
scalaでメモリ―オーバー; scalaのjava.lang.OutOfMemoryError: Java heap space の対処法: ヒープの最大値をオプションで指定 scala -J-Xmx1024m xxxx.scala scala -J-Dfile.encoding=UTF-8 -J-Xmx1500m -deprecation xxxx.scala http://www.javaroad.jp/f…
awkでランダムサンプル awk 'BEGIN{b[0]=2;b[1]=3;b[2]=4;srand();for(i=0;i エッセンス: awk 'BEGIN{b[0]=2;b[1]=3;b[2]=4;srand();print b[int(length(b)*rand())]}' もっとエッセンス: int(length(b)*rand())
scalaでファイル出力 import java.io.PrintWriter object test{ def main(args: Array[String]){ var p=new PrintWriter("test.txt") p.println("hello\n"); p.println("java\n") p.flush p.close } }
ArrayBufferクラスを用いる. import scala.collection.mutable.ArrayBuffer object ArrayTest{ def main(args:Array[String])={ var a=new ArrayBuffer[Double] a.append(1.0) a.append(2.0) a.append(7.0) //a+=(7.0)も同じ! println(a(1)); a.foreach{pr…
タスク: ランダムウォークを2つ発生させて,それらをいくつかの時間スケールでbox平均をとり, 各時間スケールでグレンジャー因果検定をし,すべての時間スケールでもっとも小さい値を調べる. 上記を100回繰り返す. 計測結果 R 369.96秒 scala 6.655…
グレンジャー因果検定: 注意事項 #本当の因果関係でないことに注意。 例えば,精度のよい天気予報と天気は因果関係ありと判定してしまう. また,線形モデルを仮定するので,モデルが非線形の場合は正確ではない. アイデア: x→yの相関を考える. y(t+1)…
http://winnie.kuis.kyoto-u.ac.jp/~murase/howto/linux.xmlより ~/.Xresourcesに以下のように書く。 Tgif.FontSizes: 8 9 10 11 12 13 14 15 16 17 18 19 \ 20 22 24 26 28 30 32 34 36 38 40 42 \ 44 46 48 52 56 60 64 70 74 78 82 86 \ 90 94 100 120 14…
うーん。なんかリスト→Arrayが微妙… import scala.util.Random j=Random.shuffle(diff_data2.toList).toArray ランダムウォーク var tmp=0.0; var rand1=(0 to data2.length).map{b=> tmp=tmp+Random.nextGau ssian();tmp}
var tmp=a(0);a.map{b=>var c=b-tmp;tmp=b;c}.slice(1,a.length) こんな感じ scala> a res18: Array[Int] = Array(1, 2, 3, 4, 7)scala> tmp=a(0);a.map{b=>var c=b-tmp;tmp=b;c}.slice(1,a.length) tmp: Int = 7 res19: Array[Int] = Array(1, 1, 1, 3)
PPT図をTEXに張り込むのにはまったので記録。まず、少し前までつかえた、PSプリンタをパワポにとりこむ、 EPSにして出力、バウンダリーボックスを調整して入れ込むという 方法はもう使えないみたいです。これらの方法はもうだめ http://www4.cs.miyazaki-u.a…