Skip to content

Instantly share code, notes, and snippets.

View mosasiru's full-sized avatar

mosa mosasiru

View GitHub Profile
@mosasiru
mosasiru / manager.py
Created November 4, 2016 06:46
MySQLBulkInsertManager
from django.db import models
from django.db.models import sql
class MySQLBulkInsertManager(models.Manager):
""" bulkでinsert on duplicate updateするためのマネージャー
"""
def bulk_insert_on_duplicate(self, obj_list, update_fields, batch_size=None):
""" Usage
@mosasiru
mosasiru / gist:c4a0b4620e5b0d93ca2e
Last active August 29, 2015 14:22
git覚えるべきコマンド集 (普段使うコマンドの99%がこれ)
git clone https://github.com/atilika/kuromoji
git pull
git status
git branch
git branch -a
git log
git add .
git add hoge
git co master
git co -b topic/branch
p(w,t|x,α,β) = p(w|t,x,α,β)p(t|x,α,β) (1)
p(w,t|x,α,β) = p(t|w,x,α,β)p(w|t,α,β) (2)
(1)(2)比較して、
p(w|t,x,α,β) = p(t|w,x,α,β)p(w|t,α,β) / p(t|x,α,β)
ここで、
分子の p(t|w,x,α,β) = p(t|w,x,β) (式1.65から、w固定時にα固定されるので)
分子の p(w|t,α,β) = p(w|α) (式1.65から)
両辺をwの関数だと思えば、分母p(t|x,α,β)は定数なので、
@mosasiru
mosasiru / rw.pl
Created January 7, 2014 18:34
stock simple random walk
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.012000;
use autodie;
use Math::Random;
use Statistics::Descriptive;