Skip to content

Instantly share code, notes, and snippets.

View matsuken92's full-sized avatar

kenmatsu4 matsuken92

View GitHub Profile
@matsuken92
matsuken92 / file0.txt
Last active August 29, 2015 14:15
pythonを使った回帰分析の概念の解説 その2 ref: http://qiita.com/kenmatsu4/items/1e37da1d55292035d985
S(\alpha, \beta) =
\left( \sum_i^n x_i^2 \right) \alpha^2 + n\beta^2
+ 2 \left( \sum_i^n x_i \right)\alpha \beta
- 2 \left( \sum_i^n x_i y_i \right)\alpha
- 2 \left( \sum_i^n y_i \right)\beta
+ \sum_i^n y_i^2
@matsuken92
matsuken92 / file0.py
Last active August 29, 2015 14:15
手書き数字をpythonでもてあそぶ その1 ref: http://qiita.com/kenmatsu4/items/79905dadb07b69f182a1
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
@matsuken92
matsuken92 / file0.py
Last active August 29, 2015 14:15
手書き数字をpythonでもてあそぶ その1 ref: http://qiita.com/kenmatsu4/items/1105b804a5a5ffdbeec3
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
@matsuken92
matsuken92 / file0.txt
Last active August 29, 2015 14:16
手書き数字をpythonでもてあそぶ その2(識別する) ref: http://qiita.com/kenmatsu4/items/2d21466078917c200033
C = \{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}
@matsuken92
matsuken92 / knn_pred_result.text
Last active August 29, 2015 14:16
Predicted result for Digits Recognizer with k-nearest neighbor method
[Predicted Data List]
2.0
0.0
9.0
9.0
3.0
7.0
0.0
3.0
0.0
@matsuken92
matsuken92 / train_vs_pred_result.tsv
Created March 1, 2015 04:33
Judge result for Digits Recognizer with k-nearest neighbor method
Tested Data Predicted Data Judge
2 2 ok
0 0 ok
9 9 ok
0 8 fail
3 3 ok
7 7 ok
0 0 ok
3 3 ok
0 0 ok
@matsuken92
matsuken92 / file0.py
Last active August 29, 2015 14:16
【機械学習】k-nearest neighbor method(k最近傍法)を自力でpythonで書いて、手書き数字の認識をする ref: http://qiita.com/kenmatsu4/items/c91f5740808022decaae
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from collections import defaultdict
@matsuken92
matsuken92 / 1-dim steepest descent.py
Last active May 6, 2023 10:30
Various types of gradient descent method
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)))
@matsuken92
matsuken92 / file0.txt
Last active January 16, 2016 16:51
確率的勾配降下法とは何か、をPythonで動かして解説する ref: http://qiita.com/kenmatsu4/items/d282054ddedbd68fecb0
\nabla f = \frac{d f({\bf x})}{d {\bf x}} = \left[ \begin{array}{r} \frac{\partial f}{\partial x_1} \\ ... \\ \frac{\partial f}{\partial x_2} \end{array} \right]
@matsuken92
matsuken92 / principal_components_analysis.py
Last active August 29, 2015 14:17
Principal Components Analysis
%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):