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
# (reference) https://ja.wikipedia.org/wiki/ガボールフィルタ | |
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as st | |
import math | |
plt.style.use('fivethirtyeight') |
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
# these code on this page are based on the following chainer's example. Thanks! | |
# https://github.com/pfnet/chainer/tree/master/examples/mnist/train_mnist.py | |
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from sklearn.datasets import fetch_mldata | |
from chainer import cuda, Variable, FunctionSet, optimizers | |
import chainer.functions as F | |
import sys, time, math |
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
# http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.eig.html | |
#numpy.linalg.eig(a)[source] | |
#Compute the eigenvalues and right eigenvectors of a square array. | |
# | |
#Parameters: | |
#a : (..., M, M) array | |
#Matrices for which the eigenvalues and right eigenvectors will be computed | |
#Returns: | |
#w : (..., M) array | |
#The eigenvalues, each repeated according to its multiplicity. The eigenvalues are not necessarily ordered. The resulting array will be #always be of complex type. When a is real the resulting eigenvalues will be real (0 imaginary part) or occur in conjugate pairs |
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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from matplotlib import animation as ani | |
plt.figure(figsize=(8,8)) | |
n=20 |
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
%matplotlib inline | |
import sys | |
import matplotlib.pyplot as plt | |
from matplotlib import animation as ani | |
import numpy as np | |
import pandas as pd | |
import scipy.stats as st | |
from scipy.special import ndtri | |
# Data Import |
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
%matplotlib inline | |
import sys | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as st | |
from matplotlib import animation as ani | |
import sklearn.metrics as mt |
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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.stats import chi2 | |
from matplotlib import animation as ani | |
def plot_dist(data, bins, title =""): | |
plt.figure(figsize=(7,5)) | |
plt.title(title) | |
plt.hist(data, bins, color="lightgreen", normed=True) |
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
# coding:utf-8 | |
%matplotlib inline | |
import matplotlib.pyplot as plt | |
from wordcloud import WordCloud | |
from bs4 import BeautifulSoup | |
import requests | |
import MeCab as mc | |
def mecab_analysis(text): | |
t = mc.Tagger('-Ochasen -d /usr/local/Cellar/mecab/0.996/lib/mecab/dic/mecab-ipadic-neologd/') |
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 requests_oauthlib import OAuth1Session | |
from requests.exceptions import ConnectionError, ReadTimeout, SSLError | |
import json, datetime, time, pytz, re, sys, traceback, unicodedata, pymongo | |
#from pymongo import Connection # Connection classは廃止されたのでMongoClientに変更 | |
from pymongo import MongoClient | |
import numpy as np | |
from collections import defaultdict | |
from bson.objectid import ObjectId | |
import MeCab as mc |
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
%matplotlib inline | |
import numpy as np | |
import sklearn.decomposition as decomp | |
import matplotlib.pyplot as plt | |
import matplotlib.cm as cm | |
# function definitions | |
class DigitData: | |
def __init__(self, data): |