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 matplotlib.pyplot as plt | |
from moviepy.editor import * | |
from matplotlib import animation as ani | |
sigma = 1 | |
mu = 3 | |
def norm_dist_neg(x): | |
return -1./(np.sqrt(2 * np.pi) * sigma)* np.exp(-0.5*((x-mu)**2)/((sigma**2))) |
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 | |
from matplotlib import animation as ani | |
import numpy as np | |
import sys | |
plt.style.use('ggplot') |
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 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
# 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
%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
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
from sklearn.model_selection._search import ParameterGrid | |
param_grid = { | |
"metric_list" : [None, "None", "binary_logloss", "auc", ["binary_logloss"], ["auc"], | |
['binary_logloss','auc', ], ['auc', 'binary_logloss',] ], | |
"first_metric_only": [True, False], | |
"eval_train_metric": [True, False], | |
} | |
pg = ParameterGrid(param_grid) |
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
%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 |
NewerOlder