Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
from sklearn.datasets import load_iris | |
def softmax(inputs): | |
return np.exp(inputs) / np.sum(np.exp(inputs), 1)[:, None] | |
def construct_net(in_dim, out_dim, hidden_dim=20): | |
bound1 = np.sqrt(6.0 / (in_dim + hidden_dim)) |
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
class TrieNode(object): | |
def __init__(self): | |
self.children = dict() | |
self.is_word = False | |
class TrieTree(object): | |
def __init__(self): |
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 | |
data = [[1.658985, 4.285136], [-3.453687, 3.424321], [4.838138, -1.151539], | |
[-5.37971, -3.362104], [0.972564, 2.924086], [-3.567919, 1.531611], | |
[0.450614, -3.302219], [-3.487105, -1.724432], [2.668759, 1.594842], | |
[-3.15648, 3.191137], [3.165506, -3.999838], [-2.786837, -3.099354], | |
[4.208187, 2.984927], [-2.123337, 2.943366], [0.704199, -0.479481], | |
[-0.392370, -3.963704], [2.831667, 1.574018], [-0.790153, 3.343144], | |
[2.943496, -3.357075], [-3.195883, -2.283926], [2.336445, 2.875106], |
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 __future__ import division | |
import csv | |
import numpy as np | |
import random | |
import tensorflow as tf | |
# data prepare | |
X, y = [], [] |
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 PIL import Image | |
def eig_decomposition(img, p=0.9): | |
A = np.array(img, dtype=float) | |
mean_A = np.mean(A) | |
A -= mean_A | |
# calculate covarience matrix |