Skip to content

Instantly share code, notes, and snippets.


Danqing Liu danqing

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

Keybase proof

I hereby claim:

  • I am danqing on github.
  • I am 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
danqing /
Last active Aug 23, 2017
Machine learning for humans - What is machine learning 01 -
from datetime import datetime
def predict_head_or_tail():
current_second =
return 'head' if current_second % 2 else 'tail'
predict_head_or_tail() # 50/50 chance for head/tail
danqing /
Last active Aug 23, 2017
Machine learning for humans - What is machine learning 02 -
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!
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 /
Created Aug 2, 2016
Some scratch of w2v experiments
import numpy
from numpy.linalg import norm
from nltk.corpus import stopwords
from nltk import download
stop_words = stopwords.words('english')
sset = [
'whats the weather like',
danqing /
Created Mar 17, 2016
Check updates for pip packages
#!/usr/bin/env python
import xmlrpclib
import pip
pypi = xmlrpclib.ServerProxy('')
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.