Skip to content

Instantly share code, notes, and snippets.

trtd56 / file0.txt
Last active August 9, 2016 18:46
ChainerでAutoencoder(+ trainerの使い方の備忘録) ref:
class Autoencoder(chainer.Chain):
def __init__(self):
super(Autoencoder, self).__init__(
encoder = L.Linear(784, 64),
decoder = L.Linear(64, 784))
def __call__(self, x, hidden=False):
h = F.relu(self.encoder(x))
if hidden:
return h
trtd56 / file0.txt
Last active August 14, 2016 22:39
Chainerのtrainerを使ってCIFAR-10の分類に挑戦したかった ref:
def unpickle(file):
fp = open(file, 'rb')
if sys.version_info.major == 2:
data = pickle.load(fp)
elif sys.version_info.major == 3:
data = pickle.load(fp, encoding='latin-1')
return data
trtd56 / file0.txt
Created July 30, 2016 06:55
Chainer✕OpenAI GymでDQN(もどき)に挑戦! ref:
$ pip install gym
import copy, sys
import numpy as np
from collections import deque
import chainer
import chainer.links as L
import chainer.functions as F
from chainer import Chain, optimizers, Variable, serializers
class Neuralnet(Chain):
trtd56 / file0.txt
Created June 30, 2016 10:53
WindowsでChainer環境を整える ref:
cd [whlファイルがあるディレクトリ]
pip install numpy-1.11.1+mkl-cp27-cp27m-win_amd64.whl