Skip to content

Instantly share code, notes, and snippets.

Aerin Kim aerinkim

  • Redmond, WA
Block or report user

Report or block aerinkim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aerinkim
aerinkim / Kmeans.py
Created Feb 24, 2019
K-means Python Implementation from scratch
View Kmeans.py
from sklearn import datasets
def Kmeans(X, K):
m = len(X)
X_centroid = dict() # Save which sample belong to which cluster.
X_centroid.fromkeys(range(0, m))
C = dict() # Save cluster's cordinate
C.fromkeys(range(0, K))
old_C = None # Cache to save old C. Used for an early termination.
# 1. Randomly initialize k centroids.
@aerinkim
aerinkim / my_adam.py
Last active Dec 28, 2018
Adam Implementation from scratch
View my_adam.py
from torch.optim import Optimizer
class ADAMOptimizer(Optimizer):
"""
implements ADAM Algorithm, as a preceding step.
"""
def __init__(self, params, lr=1e-3, betas=(0.9, 0.99), eps=1e-8, weight_decay=0):
defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay)
super(ADAMOptimizer, self).__init__(params, defaults)
You can’t perform that action at this time.