Skip to content

Instantly share code, notes, and snippets.

View phyblas's full-sized avatar
💤

雛星 φυβλας phyblas

💤
View GitHub Profile
@phyblas
phyblas / logopythainlp.py
Created October 21, 2017 09:18
สร้างโลโกสำหรับ PyThaiNLP
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap as licama
def rabaisi(x1,y1,x2,y2,si):
n = len(x1)
xt = np.where(np.arange(n)%2,x1,x2)
yt = np.where(np.arange(n)%2,y1,y2)
plt.tripcolor(xt,yt,np.arange(3)+np.arange(n-2)[:,None],facecolors=np.ones(n-2),cmap=licama([si]))
@phyblas
phyblas / thotthoilogistic.py
Last active February 11, 2020 02:35
การถดถอยโลจิสติก
import numpy as np
def softmax(x):
exp_x = np.exp(x.T-x.max(1))
return (exp_x/exp_x.sum(0)).T
class Sgd:
def __init__(self,eta=0.01):
self.eta = eta
@phyblas
phyblas / file11.txt
Last active September 22, 2019 03:56
MNIST手書き数字データをnumpyで書いたロジスティック回帰で学習して結果を分析する ref: https://qiita.com/phyblas/items/375ab130e53b0d04f784
[1276 0 4 2 3 9 8 3 6 1]
[ 0 1556 11 4 1 5 0 4 17 6]
[ 9 16 1225 21 11 3 15 16 26 6]
[ 4 12 33 1269 0 45 3 17 34 10]
[ 5 7 11 2 1245 3 16 5 12 56]
[ 12 6 16 44 10 1105 25 10 39 13]
[ 12 3 9 0 5 16 1343 2 4 3]
[ 6 4 20 5 14 1 1 1377 1 32]
[ 6 34 12 36 7 24 10 5 1242 14]
[ 10 6 6 20 35 12 1 46 10 1273]