This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import keras | |
from sklearn.model_selection import train_test_split | |
""" | |
ベクトルx,yは与えられているとする. | |
y = A * x となる行列Aを求める. | |
- 行列とベクトルの積, <https://stackoverflow.com/questions/46570963/keras-lambda-layer-for-matrix-vector-multiplication> | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Trains a LSTM with Word2Vec on the SNLI dataset. | |
https://nlp.stanford.edu/projects/snli/ | |
Get to 80.12% test accuracy after 18 epochs. | |
""" | |
import numpy as np | |
import pandas as pd | |
from gensim.models import KeyedVectors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Implementation of ESIM(Enhanced LSTM for Natural Language Inference) | |
https://arxiv.org/abs/1609.06038 | |
""" | |
import numpy as np | |
from keras.layers import * | |
from keras.activations import softmax | |
from keras.models import Model | |
def StaticEmbedding(embedding_matrix): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.layers import * | |
from keras.activations import softmax | |
from keras.models import Model | |
""" | |
References | |
---------- | |
[1]. Parikh, Ankur P., et al. "A decomposable attention model for natural language inference." arXiv preprint arXiv:1606.01933 (2016). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import requests | |
import pandas as pd | |
import datetime | |
""" | |
coincheckのPublic API用データ取得ツール |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mnist_expert.py | |
import tensorflow as tf | |
import os | |
if not os.path.exists("input_data.py"): | |
os.system("curl https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/examples/tutorials/mnist/input_data.py -o input_data.py") | |
import input_data | |
def conv2d(x, W): | |
return tf.nn.conv2d(x, W, strides=[1,1,1,1], padding='SAME') |