Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Chris Hoyean Song chris-chris

🎯
Focusing
View GitHub Profile
@chris-chris
chris-chris / simple_gradient_descent.py
Last active Sep 11, 2017
simple 1-step gradient descent
View simple_gradient_descent.py
# From udacity Machine Learning Nanodegree course
import numpy as np
# Define sigmoid function
def sigmoid(x):
return 1/(1+np.exp(-x))
# Derivative of the sigmoid function
def sigmoid_derivative(x):
View LSTM_in_numpy.py
import tensorflow as tf
import numpy as np
from tensorflow.python.ops import variable_scope
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import variables
from tensorflow.contrib.rnn.python.ops import rnn_cell
res = []
@chris-chris
chris-chris / cnn-in-numpy.py
Last active Jun 24, 2018
Convolution in numpy
View cnn-in-numpy.py
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import dtypes
# 1. Setting up initial values
x = np.zeros((7, 7, 3))
x[:, :, 0] = np.mat(
"0 0 0 0 0 0 0;0 0 1 0 1 0 0;0 2 1 0 1 2 0;0 0 2 0 0 1 0;0 2 0 1 0 0 0;0 0 0 1 2 2 0;0 0 0 0 0 0 0"
).A
@chris-chris
chris-chris / lstm.py
Last active Aug 27, 2018 — forked from karpathy/gist:587454dc0146a6ae21fc
An efficient, batched LSTM.
View lstm.py
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@chris-chris
chris-chris / min-char-rnn.py
Last active Aug 30, 2018 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
Korean translation
최소 버전의 단어 레벨 바닐라 RNN 모델. Andrej Karpathy (@karpathy) 작성
- Korean comments
- Python3 compatibility update
"""
@chris-chris
chris-chris / sentry-centos-install.sh
Created Oct 27, 2018
One-shot dockerized sentry install
View sentry-centos-install.sh
# 1. Install docker
# https://docs.docker.com/install/linux/docker-ce/centos/#install-docker-ce-1
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
@chris-chris
chris-chris / hashable_cache.py
Created Jul 22, 2019 — forked from adah1972/hashable_cache.py
Decorator for using dicts/lists with any Python cache function (like lru_cache)
View hashable_cache.py
# Inspired by https://gist.github.com/harel/9ced5ed51b97a084dec71b9595565a71
from collections import namedtuple
import functools
import json
import six
Serialized = namedtuple('Serialized', 'json')
@chris-chris
chris-chris / selenium-install
Created Sep 12, 2019 — forked from kaze/selenium-install
How to install Chrome, ChromeDriver and Selenium on CentOS. Plus a sample scraping script.
View selenium-install
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@chris-chris
chris-chris / System Design.md
Created Jun 3, 2020 — forked from vasanthk/System Design.md
System Design Cheatsheet
View System Design.md

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@chris-chris
chris-chris / teachable_machine_with_upload.html
Last active Aug 15, 2020
Teachable Machine with upload button
View teachable_machine_with_upload.html
<html>
<head>
<title>Teachable Machine Image Model with upload</title>
</head>
<body>
<img id="imagePreview" style="height: 300px;" />
<input id="imageUpload" type="file" />
<div>Teachable Machine Image Model with upload</div>
<div id="label-container"></div>