Skip to content

Instantly share code, notes, and snippets.

View xiaohan2012's full-sized avatar
🍠
eating sweat potatos

Xiao Han xiaohan2012

🍠
eating sweat potatos
View GitHub Profile
@xiaohan2012
xiaohan2012 / get_tensor_value_from_checkpoint.py
Created September 26, 2017 19:08
tensorflow: get tensor value from checkpoint
import tensorflow as tf
checkpoint_file = 'runs/deepwalk/checkpoints/model-25000'
sess = tf.InteractiveSession()
saver = tf.train.import_meta_graph("{}.meta".format(checkpoint_file))
saver.restore(sess, checkpoint_file)
embedding_table = sess.graph.get_operation_by_name('embedding/table')
CXX=g++
CPPFLAGS=-std=c++11 -O2 -Wall
LINK_OPTS=-shared -Wl,--export-dynamic
COMPILE_OPTS=-fPIC
INCLUDES=-I /usr/include/python3.5/
LIBS=-L /usr/lib/x86_64-linux-gnu/ -l boost_python-py35
%.so: %.o
$(CXX) $^ $(CPPFLAGS) $(LINK_OPTS) $(LIBS) -o $@
CXX=g++
CPPFLAGS=-std=c++11 -O2 -Wall
ODIR=obj
DEPS=-I boost
%: $(ODIR)/%.o
$(CXX) -o $@ $^ $(CPPFLAGS)
$(ODIR)/%.o: %.cpp $(DEPS)
$(CXX) -c -o $@ $< $(CPPFLAGS)
@xiaohan2012
xiaohan2012 / makefile-cpp
Created September 5, 2017 13:33
makefile for cpp
CXX=g++
CPPFLAGS=-std=c++11 -O2 -Wall
ODIR=obj
DEPS=-I boost
%: $(ODIR)/%.o
$(CXX) -o $@ $^ $(CPPFLAGS)
$(ODIR)/%.o: %.cpp $(DEPS)
$(CXX) -c -o $@ $< $(CPPFLAGS)
@xiaohan2012
xiaohan2012 / links.md
Created March 21, 2016 12:56
Links for interaction summarization
  • mistake about the bound:
  • synthetic experiment design
    • dynamics of conversations
    • parameters?
      • event/total participant number: influences the event
      • event/total duration: influences the event
    • should we compare the pred tree with actual tree?
  • exploration/exploitation experiment

PCST:

  • why I work on PCST
    • the road map: PCST->MST->Quota->Budget
    • PCST->MST
    • MST = Quota
    • Quota -> Budget: how the 5-approximation comes?
    • that's for undirected case
  • incorrectness of the proof on the greedy primal-dual method
  • the chapter
@xiaohan2012
xiaohan2012 / depparse_output_parser.py
Created February 10, 2015 13:58
Parser and tree visualization for Stanford Depency Parser output
# -*- coding: utf-8 -*-
"""
Parser for Stanford Dependency Parser output to parse back the original data structure in Python
The parser link:
http://nlp.stanford.edu/software/nndep.shtml
The visualization can be created by generating .dot file
@xiaohan2012
xiaohan2012 / compare_adagrad_adadelta.py
Created January 29, 2015 12:29
Comparing adagrad, adadelta in gradient descent in Theano
"""
Comparing adagrad, adadelta and constant learning in gradient descent(the seddle point function y^2 - x^2)
Reference:
1. comparison on several learning rate update scheme: http://ml.memect.com/archive/2014-12-12/short.html#3786866375172817
2. Saddle point, http://en.wikipedia.org/wiki/Saddle_point
"""
import numpy as np
import theano
@xiaohan2012
xiaohan2012 / CYK-C++-Makefile
Last active April 6, 2018 22:54
CYK parsing algorithm in C++
all: btree types.h rule table cyk main
g++-4.7 -std=c++11 *.o -o main
main: main.cpp
g++-4.7 -c -std=c++11 main.cpp
cyk: cyk.cpp
g++-4.7 -c -std=c++11 cyk.cpp
btree: btree.cpp