This file contains hidden or 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 | |
| from scipy import stats | |
| import math | |
| class ModelSelection: | |
| """ | |
| Distribution selector using AIC | |
| """ | |
| def estNormal(self, sample): |
This file contains hidden or 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
| /* | |
| cuSolverを使ってコレスキー分解の逆行列を計算。 | |
| AX=I(Iは単位行列)として逆行列Xを求める | |
| gcc -o cusolver_inverse_matrix -I/usr/local/cuda/include/ -L/usr/local/cuda/lib64/ cusolver_inverse_matrix.c -lcudart -lcusolver | |
| */ | |
| #include <cuda_runtime.h> | |
| #include <cusolverDn.h> |
This file contains hidden or 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.random.mtrand | |
| import numpy as np | |
| class LdaCvb0: | |
| def __init__(self, word_indexes, word_counts, n_topics, alpha=0.1, beta=0.01): | |
| self.word_counts = word_counts | |
| self.word_indexes = word_indexes | |
| self.n_words = np.max(np.max(word_indexes)) + 1 | |
| self.n_topics = n_topics |
This file contains hidden or 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 -*- | |
| """ | |
| 多重コレスポンデンス分析ライブラリ(https://github.com/esafak/mca)の使用例 | |
| """ | |
| import numpy as np | |
| import numpy.random as random | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| import mca |
This file contains hidden or 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 -*- | |
| """ | |
| matplotlibで都道府県地図を描画 | |
| """ | |
| import matplotlib.path as mpath | |
| import matplotlib.patches as mpatches | |
| import matplotlib.pyplot as plt | |
| from matplotlib.patches import Circle, Wedge, Polygon | |
| from matplotlib.collections import PatchCollection |
This file contains hidden or 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 -*- | |
| """ | |
| 自然な共益事前分布を使って線形回帰モデルの係数をベイズ推定 | |
| 【事前分布】 | |
| 平均:多変量正規分布 | |
| """ | |
| from numpy.random import * | |
| import numpy as np | |
| from mpl_toolkits.mplot3d import Axes3D |
This file contains hidden or 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 numpy as np | |
| import scipy.stats |
This file contains hidden or 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 xgboost as xgb | |
| import numpy as np | |
| import scipy.stats | |
| import matplotlib.mlab as mlab | |
| import matplotlib.pyplot as plt | |
| import math | |
| import sys | |
| from hyperopt import hp |
NewerOlder