git clone git@bitbucket.org:syou6162/hoge.git
git add ...
git ci "Save WIP"
git push origin HEAD:WIP-foo
git branch WIP-foo origin/WIP-foo # remoteにしかないからlocalにブランチを作る
git diff --no-prefix develop WIP-foo > p
This file contains 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
(let [seed (java.util.Random. 1)] | |
(with-redefs [rand (fn [n] (* n (. seed nextDouble)))] | |
(mapv (fn [_] (rand-int 2)) (range 10)))) |
k-best MIRAはk=1のときはclosed-formで重み更新式が書けるが、k>1のときはclosed-formでは解くことができない。k>1のときに解が欲しければ、真面目にQPを解く必要がある。MSTParserの中で使われているQPを解くアルゴリズムにはHildreth algorithmが使われている。
Hildreth algorithm自体について説明しているWeb上のリソースはあまりないが、以下のサイトは雰囲気がつかめる。SMOのようにひとつの変数に着目して、それ以外は止めて一変数について最適化、というのを繰り返すようである。
Hildreth algorithmで出力されるのは双対変数なので、主問題の変数には変換する必要があることに注意。
This file contains 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
(function(){ | |
var datePattern = new RegExp("(\\d{4})年(\\d{1,2})月(\\d{1,2})日"); | |
function formatEntry(entry) { | |
entry.date.match(datePattern); | |
var year = RegExp.$1; | |
var month = RegExp.$2; if (month.length <= 1) month = "0" + month; | |
var day = RegExp.$3; if (day.length <= 1) day = "0" + day; | |
var item = entry.item.split("\"").join("\"\""); | |
return year + month + day + ",,," + entry.price + ",\"Amazon: " + item + "\"\n"; | |
} |
This file contains 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
(function(){ | |
var total = {}; | |
var year = '2012'; | |
var all = false; | |
function init(num) { | |
if(typeof num !== 'number') { | |
num = 0; | |
$('<div/>').css({ | |
position: 'fixed', | |
left: 0, |
This file contains 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
;;; dabbrev-expand-multiple.el --- dabbrev-expand for multiple | |
;; Copyright (C) 2007 khiker | |
;; Author: khiker <khiker+elisp@gmail.com> | |
;; plus <MLB33828@nifty.com> | |
;; Keywords: dabbrev | |
;; This file is free software; you can redistribute it and/or modify |
This file contains 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
#直積を書き出す関数 | |
write.direct.product <- function(x,y){ | |
e <- expand.grid(x,y) | |
m <- mapply(function(x,y){paste("(",x,",",y,")",sep="")},e[,1],e[,2]) | |
return(paste("{",paste(m,collapse=","),"}",sep="")) | |
} | |
write.direct.product(1:3,4:6) | |
#R \times RからRへの写像の例 | |
apply(expand.grid(1:3,4:6),1,function(x){x[1]*x[2]}) |
This file contains 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(scatterplot3d) | |
steepest_descent <- function(epsilon,tau,x_bar1=-10,x_bar2=-20,beta=1,n=2000){ | |
#関数内関数の定義 | |
f <- function(x){x1 <- x[1];x2 <- x[2];return(100*(x1-x2)^2+(x1-1)^2)} | |
#数式微分 | |
trig.exp <- expression(100*(x1-x2)^2+(x1-1)^2) | |
D.sc1 <- D(trig.exp, "x1") | |
D.sc2 <- D(trig.exp, "x2") |
This file contains 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
(use '(incanter core stats charts)) | |
(def min-val 1) | |
(def max-val 10) | |
(def chart-before (function-plot sin min-val max-val)) | |
(def x (view chart-before)) | |
(def chart-after (function-plot log min-val max-val)) |
OlderNewer