Skip to content

Instantly share code, notes, and snippets.

View katsugeneration's full-sized avatar

Katsuya Shimabukuro katsugeneration

View GitHub Profile
@katsugeneration
katsugeneration / iris_tensorflow.py
Created July 18, 2016 07:34
TensorFlow basic DNN
import tensorflow as tf
import numpy as np
import pandas as pd
import math
# Data sets
IRIS_TRAINING = "iris_training.csv"
IRIS_TEST = "iris_test.csv"
IRIS_DATA_SIZE = 4
CLASS_SIZE = 3
@katsugeneration
katsugeneration / spiralnn.ipynb
Last active August 27, 2017 12:49
DNN Clasifier with spiral data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
I = 100
data = np.random.normal(0, 2, I)
y = np.ones(I)
plt.hold(False)
plt.plot(data, y, "o")
@katsugeneration
katsugeneration / tenforflow_rnn.py
Created August 7, 2016 09:40
TensorFlow basic RNN sample
import numpy as np
import tensorflow as tf
import reader
import time
class PTBModel:
@property
def optimizer(self):
return self._optimizer
@katsugeneration
katsugeneration / cnn.py
Last active August 24, 2017 15:54
TensorFlow Basic CNN
import tensorflow as tf
import reader
from datetime import datetime
import os.path
import time
import numpy as np
# Tensorflow の cifar10 サンプルの書き換え
# 学習率を徐々に下げたり、評価時の重みは移動平均を使ったりしているがそれはやっていない
@katsugeneration
katsugeneration / viz_filter.py
Last active August 24, 2017 15:53
Convert image by CNN weights
import numpy as np
from scipy.ndimage import convolve
import tensorflow as tf
from tensorflow import pywrap_tensorflow
from PIL import Image
from matplotlib import pyplot as plt
plt.axis('off')
img = Image.open('009_0001.jpg')
plt.imshow(img)
@katsugeneration
katsugeneration / skip_thoughts_word2vec.py
Created May 15, 2016 07:28
Skip-Thought Vectors を word2vec を入出力にして行う実験用コード
# coding:utf-8
import chainer
from chainer import cuda
import chainer.links as L
import chainer.functions as F
from chainer import optimizers
from chainer import serializers
from chainer.functions.activation import sigmoid
--langdef=Swift
--langmap=Swift:+.swift
--regex-swift=/(var|let)[ \t]+([^:=]+).*$/\2/,variable/
--regex-swift=/func[ \t]+([^\(\)]+)\([^\(\)]*\)/\1/,function/
--regex-swift=/class[ \t]+([^:\{]+).*$/\1/,class/
--regex-swift=/protocol[ \t]+([^:\{]+).*$/\1/,protocol/