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 / 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):
# 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
@matsuken92
matsuken92 / 01_gabor_filter.py
Last active August 29, 2015 14:24
Gabor Filter
# (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')