Skip to content

Instantly share code, notes, and snippets.

🎙
Society!

Danqing Liu danqing

🎙
Society!
Block or report user

Report or block danqing

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
View keybase.md

Keybase proof

I hereby claim:

  • I am danqing on github.
  • I am danqing (https://keybase.io/danqing) on keybase.
  • I have a public key ASCOgKDXtW1K03A5_coDVN3qeBJSUQjriIw3hqQEWt7YxQo

To claim this, I am signing this object:

View blockstack
Verifying my Blockstack ID is secured with the address 16DThYAyWydSWE6D2tHYsuYYFJTxAVDK4Y https://explorer.blockstack.org/address/16DThYAyWydSWE6D2tHYsuYYFJTxAVDK4Y
@danqing
danqing / not_ml.py
Last active Aug 23, 2017
Machine learning for humans - What is machine learning 01 - www.tinymind.ai
View not_ml.py
from datetime import datetime
def predict_head_or_tail():
current_second = datetime.now().second
return 'head' if current_second % 2 else 'tail'
predict_head_or_tail() # 50/50 chance for head/tail
@danqing
danqing / ml.py
Last active Aug 23, 2017
Machine learning for humans - What is machine learning 02 - www.tinymind.ai
View ml.py
class FlipPredictor(object):
def __init__(self):
self.tries = 0 # Total tries so far.
self.guess = 5 # Current guess.
def predict(self, previous):
"""Predict # heads in the next 10 flips.
previous is # heads in the previous 10 flips. That's what we learn from!
View mnist.py
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.optimizers import RMSprop
batch_size = 128
num_classes = 10
@danqing
danqing / w2v_scratch.py
Created Aug 2, 2016
Some scratch of w2v experiments
View w2v_scratch.py
import numpy
from numpy.linalg import norm
from nltk.corpus import stopwords
from nltk import download
download('stopwords')
stop_words = stopwords.words('english')
sset = [
'whats the weather like',
@danqing
danqing / update.py
Created Mar 17, 2016
Check updates for pip packages
View update.py
#!/usr/bin/env python
import xmlrpclib
import pip
pypi = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
for dist in pip.get_installed_distributions():
available = pypi.package_releases(dist.project_name)
if not available:
# Try to capitalize pkg name
You can’t perform that action at this time.