kenmatsu4’s study log.

主に統計学、機械学習、数学の学習ログです。

Mathjaxてすと、syntax highlightてすと

Texのテスト

[tex:{ \displaystyle
\sum_{i=1}^{n} (x_i - \mu)^{2}
}]

{ \displaystyle
\sum_{i=1}^{n} (x_i - \mu)^{2}
}

[tex:{ \displaystyle
f(x) = { 1 \over \sqrt{2 \pi \sigma^{2} } } \exp \left( -{1 \over 2 } {(x_i - \mu)^{2} \over \sigma^{2} } \right)
}]

{ \displaystyle
f(x) = { 1 \over \sqrt{2 \pi \sigma^{2} } } \exp \left( -{1 \over 2 } {(x_i - \mu)^{2} \over \sigma^{2} } \right)
}

[tex:{ \displaystyle
\theta_j := \theta_j - \alpha\frac{\partial}{\partial\theta_j}J(\theta_0,\theta_1)\space(for \space j = 0 \space and \space j = 1)
}] 

{ \displaystyle
\theta_j := \theta_j - \alpha\frac{\partial}{\partial\theta_j}J(\theta_0,\theta_1)\space(for \space j = 0 \space and \space j = 1)
}

Syntax Highligh設定

設定したcss

[デザイン] -> [カスタマイズ] -> [デザインCSS]に下記を指定。molokai風。

.entry-content pre.code {
    background-color: #1D1E19;
    color: #FFFFFF;
}
.synComment { color: #625F4B; }
.synPreProc { color: #F70057; }
.synStatement { color: #F70057; }
.synConstant { color: #E0D75A; }

.synSpecial { color: #93a1a1; }
.synType { color: #96E309; }
.synIdentifier { color: #52D1ED; }
Pythonのテスト
# coding:utf-8
from flask import Flask, request
import time

app = Flask(__name__)

@app.route('/', methods=['POST', 'GET'])
def hello_world():
    delay = request.args.get("delay", default=0, type=int)
    time.sleep(delay/1000.)
    return '<html><body>test site. sleep time= {}ms</body></html>'.format(delay)

if __name__ == '__main__':
    app.run(debug=True)
    print

for x in range(10):

 # -*- coding: utf-8 -*-

 for i in xrange(10):
   print i, "hello, world!"
Rのテスト
###############################################################
# ベルヌーイ分布
###############################################################
# ベルヌーイ分布からのサンプリングを実行

# パラメーター
p = 0.7
trial_size = 10000
set.seed(71)

# ベルヌーイ分布に従う乱数生成
data <- rbern(trial_size, p)
# ベルヌーイ分布の確率分布
dens <- data.frame(y=c((1-p),p)*trial_size, x=c(0, 1))

# グラフ描画
ggplot() +
    layer(data=data.frame(x=data), mapping=aes(x=x), geom="bar",
          stat="bin", bandwidth=0.1
) + layer(data=dens, mapping=aes(x=x, y=y), geom="bar",
          stat="identity", width=0.05, fill="#777799", alpha=0.7)