Skip to content

Instantly share code, notes, and snippets.

View fanannan's full-sized avatar

SAWADA Takahiro / Gugen Koubou LLC fanannan

  • Gugen Koubou LLC
  • Tokyo, Japan
View GitHub Profile
@hns
hns / hiccup-examples.js
Created October 29, 2010 19:29
Simple hiccup implementation in JavaScript
// First argument (or array element for nested arrays) is tag name.
// Second can optionally be an object, in which case it is used to
// supply attributes. All others are added to the tag's body.
html("p", {"class": "foo"}, "hello world", "!")
'<p class="foo">hello world!</p>'
// Shortcuts for denoting id and class attributes
html("p#foo.bar.baz", "hello world!")
'<p id="foo" class="bar baz">hello world!</p>'
@yuku
yuku / jawikicorpus.py
Created June 22, 2011 15:40
gensimに日本語Wikipediaを取り込むためのスクリプト
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
import os.path
import bz2
from gensim.corpora import WikiCorpus
from gensim.corpora.wikicorpus import filterWiki
@kiyukuta
kiyukuta / autoencoder.py
Last active January 23, 2020 06:16
Minimum implementation of denoising autoencoder.Error function is cross-entropy of reconstruction.Optimizing by SGD with mini-batch.Dataset is available at http://deeplearning.net/data/mnist/mnist.pkl.gz
#coding: utf8
"""
1. Download this gist.
2. Get the MNIST data.
wget http://deeplearning.net/data/mnist/mnist.pkl.gz
3. Run this code.
python autoencoder.py 100 -e 1 -b 20 -v
"""
import numpy
import argparse
@YOwatari
YOwatari / py-lda.py
Created June 16, 2014 00:03
機械学習ハッカソン(#MLHackathon)にて、作成したギブスサンプリングによるLDA実装 参考: http://ktsukuda.net/ruby/lda_with_gibbs_sampling_using_ruby/
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# パラメータの目安
# alpha k/50
# beta 0.01
import csv
from random import randint
from itertools import chain
@elben
elben / understanding-transducers.clj
Last active February 14, 2021 10:55
Understanding Transducers. See README below.
(ns my-transducers.core
(:require [clojure.core.async :as async]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Understanding Transducers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This is the source code for the blog post Understanding Transducers, found
;; here: http://elbenshira.com/blog/understanding-transducers
;;
@yasaichi
yasaichi / x_means.py
Last active August 31, 2022 12:18
Implementation of X-means clustering in Python
"""
以下の論文で提案された改良x-means法の実装
クラスター数を自動決定するk-meansアルゴリズムの拡張について
http://www.rd.dnc.ac.jp/~tunenori/doc/xmeans_euc.pdf
"""
import numpy as np
from scipy import stats
from sklearn.cluster import KMeans
@aidiary
aidiary / autoencoder.py
Last active December 9, 2015 10:20
Theanoによる自己符号化器の実装
#coding: utf-8
import time
import numpy as np
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
import gzip
import cPickle
class Autoencoder(object):
@etienne87
etienne87 / pg-pong.py
Last active October 3, 2021 06:36 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
from chainer import cuda
import cupy as cp
import time, threading
#backend