Skip to content

Instantly share code, notes, and snippets.

View monochromegane's full-sized avatar

monochromegane monochromegane

View GitHub Profile
@monochromegane
monochromegane / dgp.py
Created March 11, 2020 16:13
Plot Gamma-Poisson model and Dynamic Gamma-Poisson model
import argparse
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
def pdf_gamma(x, k, lambda_):
return (math.pow(lambda_, k)/math.gamma(k)) * math.pow(x, k-1) * math.exp(-lambda_*x)
def plot_gamma(ax, alpha, gamma, title):
@monochromegane
monochromegane / plot.py
Created October 11, 2019 00:37
Plot random number histogram and PDF(PMF) according the distribution.
import argparse
import math
import numpy as np
import matplotlib.pyplot as plt
def plot_exp_pdf(ax, lambda_):
def exp(lam, x):
if (x >= 0):
return lam * np.exp(-lam * x)
return 0
@monochromegane
monochromegane / main.go
Created October 11, 2019 00:34
Generate random number using Go standard library.
package main
import (
"flag"
"fmt"
"math/rand"
)
var (
Seed int64
@monochromegane
monochromegane / plot.py
Created February 25, 2018 11:25
Plotting outliers script called by https://github.com/monochromegane/smartsifter example.
import os
import numpy as np
import matplotlib.pyplot as plt
def plot(f, points):
n = int(f.split('_')[1].split('.')[0])
size = 100
scores = np.loadtxt("tmp/{}".format(f), delimiter=",").reshape(size, size)
xs = np.linspace(-2.5, 2.5, size, endpoint=False)
@monochromegane
monochromegane / gist:2fc28cfe7967a15f13de
Created May 7, 2015 00:20
GoCon2015summer発表案
Generative programming in Go.
こちらのエントリ http://blog.monochromegane.com/blog/2015/03/04/argen/ で紹介した `argen` をつくって得られた go generate まわりの知見を発表します。
# What
argenの簡単な紹介を通してGo言語でのGenerative programmingとは何かを説明します。
# Why
@monochromegane
monochromegane / 速習Go.md
Created July 4, 2014 09:16
速習Go。Fukuoka.go#1用の資料です。

速習Go

Go環境のつくりかた

MacOSX

homebrewでインストール

$ brew update
@monochromegane
monochromegane / VagrantPlugin.md
Last active August 29, 2015 13:56
Vagrant勉強会資料 - Vagrantプラグインの概要

title: Vagrant勉強会資料 - Vagrantプラグインの概要

date: 2014-02-27 18:00 tags: [] categories: []


Vagrantプラグインの概要

プラグイン