Skip to content

Instantly share code, notes, and snippets.

@yusuke0519
yusuke0519 / mlp.py
Created August 12, 2015 07:20
MLP with Keras
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD, Adam, RMSprop
from keras.utils import np_utils
@yusuke0519
yusuke0519 / cnn.py
Created August 12, 2015 08:26
CNN with Keras
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.utils import np_utils
@yusuke0519
yusuke0519 / my workflows
Created August 18, 2015 08:09
[Luigi]My Workflows
import luigi
import luigi.scheduler
import luigi.worker
from components import *
class MyWorkflow(luigi.Task):
'''
An example luigi workflow task, which runs a whole workflow of other luigi
tasks when executed.
@yusuke0519
yusuke0519 / dict_plus_dict.py
Created August 21, 2015 02:07
[python] dict + dict
from itertools import chain
dest = dict(chain.from_iterable(map(dict.items, list_of_dicts)))
@yusuke0519
yusuke0519 / data2file.py
Created September 2, 2015 07:15
Pythonで現在時刻をstringで取得
from datetime import datetime
date_str = datetime.now().strftime('%Y-%m-%d-%H-%M'):w
@yusuke0519
yusuke0519 / sampling.py
Created September 3, 2015 02:55
ランダムにサンプルを抽出する
import random
marks = ['club', 'diamond', 'heart', 'spade']
numbers = range(1, 14)
cards = [(m, n) for m in marks for n in numbers]
random.choice(cards) # => トランプのカードのいずれか
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yusuke0519
yusuke0519 / theanoでLogistic Regression.ipynb
Created November 16, 2015 09:45
theano, logistic regression
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.