Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time



Read Torch tutorial



Read train.lua

Learn Lua in 15 minutes


num = 42  -- All numbers are doubles.

t = nil -- Undefines t; Lua has garbage collection.

while num ## 50 do
  num = num + 1  -- No ++ or += type operators.

if num ## 40 then
  print('over 40')
elseif s ~= 'walternate' then  -- ~= is not equals.
  -- Equality check is == like Python; ok for strs.
  io.write('not over 40\n')  -- Defaults to stdout.

-- How to make a variable local:
  local line =  -- Reads next stdin line.

Install Cuda on the new Server:

problem: fail to log into gui. /dev/nvidia#### has nothing.

solved by not install opengl


Continue read torch tutorial


function get_rnn(input_size, rnn_size)
    -- there are n+1 inputs (hiddens on each layer and x)
    local input = nn.Identity()()
    local prev_h = nn.Identity()()

    -- RNN tick
    local i2h = nn.Linear(input_size, rnn_size)(input)
    local h2h = nn.Linear(rnn_size, rnn_size)(prev_h)
    local added_h = nn.CAddTable()({i2h, h2h}) --performs an element-wise addition
    local next_h = nn.Tanh()(added_h)
    return nn.gModule({input, prev_h}, {next_h})




--the model can be found at
function LSTM.lstm(opt)
    local x = nn.Identity()()
    local prev_c = nn.Identity()()
    local prev_h = nn.Identity()()

    function new_input_sum()
        -- transforms input
        local i2h            = nn.Linear(opt.rnn_size, opt.rnn_size)(x)
        -- transforms previous timestep's output
        local h2h            = nn.Linear(opt.rnn_size, opt.rnn_size)(prev_h)
        return nn.CAddTable()({i2h, h2h})

    local in_gate          = nn.Sigmoid()(new_input_sum())
    local forget_gate      = nn.Sigmoid()(new_input_sum())
    local out_gate         = nn.Sigmoid()(new_input_sum())
    local in_transform     = nn.Tanh()(new_input_sum())

    local next_c           = nn.CAddTable()({
        nn.CMulTable()({forget_gate, prev_c}),
        nn.CMulTable()({in_gate,     in_transform})
    local next_h           = nn.CMulTable()({out_gate, nn.Tanh()(next_c)})

    return nn.gModule({x, prev_c, prev_h}, {next_c, next_h})
return LSTM

Prepare data for news generator task

1.description:this task uses news text to produce train data. The source sentences are cleaned sentences from news documents and the target sentences are the next sentence after the source sentence.

2.delete sentences of length <5 or >25

Install python hdf5

sudo pip install cython
sudo apt-get install libhdf5-dev
sudo pip install h5py


Install torch on Telsa server

follow instructions on

Learn torch








write lab report

conduct experiments to tune parameters.



installed my new desktop however failed

after diable nouveau driver and reboot the system, cannot enter into text mode.


Neural Turing Machines:


understand ResNet

understand multi-attn


Word error rate

minimum number of editing steps to transform output to reference.

  1. match: words match, no cost

  2. substitution: replace one word with another

  3. insertion: add word

  4. deletion: drop word

  5. WER=(substitutions+insertions+deletions)/reference-length

  6. bleu:n-gram overlap between machine translation output and reference translation



Strategies for paraphrasing:



Original: 65 is the traditional age for workers to retire in the U.S.

Paraphrase: 65 is the traditional age for employees to retire in the U.S.


Original: 65 is the traditional age for workers to retire in the U.S.

Paraphrase: 65 is the traditional retirement age in the U.S.


Original: 65 is the traditional age for worker to retire in the U.S.

Paraphrase: 65 is the traditional age for workers to end their professional career in the U.S.

4.Phrase Reversal

Original: 65 is the traditional age for workers to retire in the U.S.

Paraphrase: In the U.S., the traditional age for workers to retire is 65.

5.Active-Passive Voice

Original: The company fired 15 workers.

Paraphrase: 15 workers were fired by the company.

6.Alternate Word Form

Original: A manager’s success is often due to perseverance.

Paraphrase: A manager often succeeds because of perseverance. Managers’ success is often because they persevere.


read train.lua

when attn=0 use the hidden state of the last rnn unit as the context vector.


read Semantic Parsing via Paraphrasing


read Tagger: Deep Unsupervised Perceptual Grouping

read GAN tutorial


read Generating Sentences From a Continuous Space

read Reasoning With Neural Tensor Networks for Knowledge Base Completion

read A Neural Conversational Model


Seven possible relations between phrases/sentences.

( slide:23

  1. equivalence

  2. forward entailment

  3. reverse entailment

  4. negation

  5. alternation

  6. cover

  7. independence


read Generating Natural Language Inference Chains

read Paraphrase-Driven Learning for Open Question Answering

read A Roadmap towards Machine Intelligence

read SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient


read Data Generation as Sequential Decision Making

read Generating Chinese Classical Poems with RNN

read Tracking The World State With Recurrent Entity Networks


read Learning Distributed Word Representations for Natural Logic Reasoning


read A Neural Attention Model for Abstractive Summarization

read Monolingual Machine Translation for Paraphrase Generation


read DIRT – Discovery of Inference Rules from Text

Ideas: words that tend to occur in the same contexts tend to have similar meanings.

read Character-Aware Neural Language Models

Ideas: each filter of the CharCNN is essentially learning to detect particular character n-grams.


read Dual Learning for Machine Translation

read 中文信息处理发展报告

read Connectionist Temporal Classification: Labelling Unsegmented Sequence Data with Recurrent Neural Networks



opencc -i wiki.zh.text -o wiki.zh.text.jian -c zht2zhs.ini


read Phased LSTM: Accelerating Recurrent Network Training for Long or Event-based Sequences

read Chinese sentence segmentation as comma classification

The punctuation comma in Chinese sometimes functions as a period causing the diffuculty of segmenting sentences in a paragraph.


read Data Programming:Creating Large Training Sets, Quickly

read Sentence Boundary Detection for Social Media Text


read text segmentation

read Elephant:Sequence Labelling for Word and Sentence Segmentation

IOB tokenization

Label tokens of a sentence.

install ruby 2.3.3

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

git clone ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.3.3
rbenv global 2.3.3
ruby -v
echo "gem: --no-ri --no-rdoc" > ~/.gemrc


read Semantic Parsing: The Task, the State-of-the-Art and the Future

read Unsupervised Semantic Parsing


read The Ubuntu Dialogue Corpus: A Large Dataset for Research in Unstructured Multi-Turn Dialogue Systems

Retrieve-based chatbot. Use dual encoders to predict whether a context and a response is a match.


read Show and Tell

read Deep Visual-Semantic Alignments for Generating Image Descriptions


find a repo which is able to convert pdf into html (

magic installation:(

Install Docker


sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates
sudo apt-key adv \
               --keyserver hkp:// \
               --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get update
sudo apt-get install docker-engine
sudo service docker start
sudo docker run hello-world


install tomcat

tar -zxvf apache-tomcat-7.0.73.tar.gz
sudo mv apache-tomcat-7.0.73 /opt/
cd /opt/apache-tomcat-7.0.73/bin/

sudo gedit
//add the following text to in the beginning
//export CATALINA_HOME=/opt/apache-tomcat-7.0.73
//export JAVA_HOME=/usr/local/java/jdk1.7.0_80

sudo ./
//Using CATALINA_BASE:   /opt/apache-tomcat-7.0.73
//Using CATALINA_HOME:   /opt/apache-tomcat-7.0.73
//Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.73/temp
//Using JRE_HOME:        /usr/lib/jdk/jdk1.7.0_80
//Using CLASSPATH:       /opt/apache-tomcat-//7.0.73/bin/bootstrap.jar:/opt/apache-tomcat-7.0.73/bin/tomcat-juli.jar
//Tomcat started.

sudo ./
//Using CATALINA_BASE:   /opt/apache-tomcat-7.0.73
//Using CATALINA_HOME:   /opt/apache-tomcat-7.0.73
//Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.73/temp
//Using JRE_HOME:        /usr/lib/jdk/jdk1.7.0_80
//Using CLASSPATH:       /opt/apache-tomcat-//7.0.73/bin/bootstrap.jar:/opt/apache-tomcat-7.0.73/bin/tomcat-juli.jar


install opencv2.4.11 for nvidia gtx series card with cuda 8.0

Useful blog(

sudo apt-get install build-essential  
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

cd opencv-2.4.11
gedit modules/gpu/src/graphcuts.cpp
replace line 45 with "#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION>=8000)"
mkdir build
cd build

make -j8
sudo make install
#sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/'  
#sudo ldconfig 

sudo apt-get install ant
#export JAVA_HOME=/usr/lib/jvm/java-6-oracle
make -j8
sudo make install


Configure opencv library path in IDEA:

  1. open "file/project structure/dependencies", add opencv jar.

  2. open "file/project structure/libraries/+/java", add opencv jar.

  3. in vm option, write: -Djava.library.path=/your_opencv_path/release/lib

  4. add "System.loadLibrary(Core.NATIVE_LIBRARY_NAME);" in java file


Install CUDA-8.0 on ubuntu14.04 with kernel:4.2.0-27-generic

sudo apt-get update
sudo apt-get install nvidia-367
sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev
sudo reboot

sudo apt-get install g++
sudo service lightdm stop
#don't install driver in the next step!!!
sudo sh
sudo reboot

sudo gedit /etc/profile
source /etc/profile

uname -r
nvcc -V


Install cuDNN5.1

tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-8.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64
sudo chmod a+r /usr/local/cuda-8.0/include/cudnn.h /usr/local/cuda-8.0/lib64/libcudnn*

Install tensorflow with gpu support for python 2.7

sudo apt-get install python-pip python-dev
sudo pip install --upgrade $TF_BINARY_URL

Configure Shiny Server

sudo gedit /etc/shiny-server/shiny-server.conf
change "run_as shiny" to "run_as username"
sudo ufw allow 3838/tcp


Deploy web application environment with Gradle and Idea

  1. Follow instructions (

  2. Set artifact (

  3. Add jsp-api.jar and servlet-api.jar


Read A Neural Network for Factoid Question Answering over Paragraphs

Read Multi-Perspective Context Matching for Machine Comprehension

Read Question Answering

IR-based question answering
knowledge-based question answering

Why QA? What kind of questions should be answered by a domain specific QA system?


Read A Rule-based Question Answering System for Reading Comprehension Tests

Read Stanford QA slides

Read Stanford chatbot slides


Read StalemateBreaker: A Proactive Content-Introducing Approach to Automatic Human-Computer Conversation

Read Building End-To-End Dialogue Systems Using Generative Hierarchical Neural Network Models


Install ffmpeg

sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
sudo apt-get update
sudo apt-get install ffmpeg


Read Bilateral Multi-Perspective Matching for Natural Language Sentences


Read Paraphrase Pattern Acquisition by Diversifiable Bootstrapping



  1. Distributional Hypothesis: Words that occur in similar contexts tend to have similar meanings
  2. Extended Distributional Hypothesis: Patterns that co-occur with similar pairs tend to have similar meanings.
  3. Latent Relation Hypothesis: Pairs of words that co-occur in similar patterns tend to have similar semantic relations.
  4. a multi-instance learning assumption (Dietterich et al., 1997) that two sentences under the same topic (we highlight topics in bold) are paraphrases if they contain at least one word pair.

Read Modeling Sentences in the Latent Space


Read Baidu lecture on Paraphrasing


Met a problem when creating a project by scrapy.

AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'


sudo pip install openssl
sudo pip install --upgrade pyOpenSSl


copy random N files to a directory

ls | shuf -n 11 | xargs cp -t /home/han/Desktop/


Read Incorporating Copying Mechanism in Sequence-to-Sequence Learning


Read TextRank:Bringing Order into Texts


Read You Only Look Once:Unified, Real-Time Object Detection

"Sum-squared error also equally weights errors in large boxes and small boxes. Our error metric should reflect that small deviations in large boxes matter less than in small boxes. To partially address this we predict the square root of the bounding box width and height instead of the width and height directly."

Read Learning Mixtures of Submodular Shells with Application to Document Summarization

Read A Class of Submodular Functions for Document Summarization


#rename all files in a directory
for f in `ls ./`;do mv $f $n.jpg; echo $n; n=$[$n+1]; done


mydir = check
mkdir $mydir
cat result.txt | awk -F " " '{if($2<="0.5") print $0}' > prob_less_50.list
n=1;for f in `cat prob_less_50.list`;do cp $f ./$mydir/$n.jpg; echo $n; n=$[$n+1]; done
ls ./mydir > rest.txt
python prob_less_50.list rest.txt todel.txt
cat todel.txt norpl.txt > negd.txt
python poss2.txt todel.txt poss3.txt
python xg1.txt todel.txt xg2.txt 


Read Mask R-CNN

Read Global Contrast based Salient Region Detection


Read TextTiling:Segmenting Text into Multi-paragraph Subtopic Passages


Read Neural Paraphrase Generation with Stacked Residual LSTM Networks


Read When Are Tree Structures Necessary for Deep Learning of Representations

Read Neural Machine Translation and Sequence-to-sequence Models:A Tutorial


Read Generating Sentences from a Continuous Space


Read Convolutional Sequence to Sequence Learning

Read A Convolutional Encoder for Neural Machine Translation


check disk space

df -h


use Kaldi

#install Kaldi
git clone
cd kaldi-shr/
chmod +x -R extras/
chmod +x configure
cd ./tools
#tar -xvzj openfst-1.3.4.tar.gz
#sudo apt-get install  subversion
sudo ln -s -f bash /bin/sh
make -j4
cd ../src
make -j4
#cd ../nnetbin/
#make -j4
#preprocess data
./shr_scripts/chw/utils/ train.list "train" | copy-feats ark:- ark,scp:./data/,./data/
./shr_scripts/chw/utils/ val.list "test" | copy-feats ark:- ark,scp:./data/,./data/


Read A fast learning algorithm for deep belief nets

Read Greedy Layer-Wise Training of Deep Networks

Read Efficient Learning of Sparse Representations with an Energy-Based Model


deploy war package in tomcat. encountered a problem "java.lang.UnsatisfiedLinkError: no segmentor_jni in java.library.path"

solved by

sudo gedit /opt/apache-tomcat-7.0.78/bin/
JAVA_OPTS=" -Djava.library.path=/home/han/Software/ltp4j/libs"

compile ltp4j on centos

cmake -DLTP_HOME=`pwd`/ltp/ .


ReadRecursive Recurrent Nets with Attention Modeling for OCR in the Wild


compile java from shell

javac -classpath /path/to/jar
java -Djava.ext.dirs=/path/to/jar/ test


train a language model using irsltm

/disk03/czj_workspace/irstlm/build/bin/ -i data_ltp.txt -n 4 -f 3,3,2,2 -k 10 -v -o train.irstlm.gz


\#check tomcat process id 

ps -ef | grep tomcat

\#check tomcat log

tail -100f ./logs/catalina.out


zip and upload file at the same time

rsync -z -P data_ltp.txt -e "ssh -p 59522" root@###.###.##.###:/data/czj_workspace
cat data_sentence.txt | sed 's/[ ]*[,,][ ]*/,\n/g' | awk '{if(length($0)>5) print}' | grep -E "大有.*之势" | less

ReadLexicon-Free Conversational Speech Recognition with Neural Networks


ReadA systematic study of the class imbalance problem in convolutional neural networks

Methods for addressing data imbalance


ReadDon't Decay the Learning Rate, Increase the Batch Size


read paper abstractions on NIPS 2016

Scan Order in Gibbs Sampling: Models in Which it Matters and Bounds on How Much

gibbs sampling, scan order, random scan, systematic scan.

Deep ADMM-Net for Compressive Sensing MRI

ADMM-net, to reconstruct MRI data from a small number of under-sampled data

A scaled Bregman theorem with applications

Bregman theorem

Swapout: Learning an ensemble of deep architectures

swapout, a regularization method, combination of dropout and stochastic depth.

On Regularizing Rademacher Observation Losses

introduced rado loss for classification problems

Without-Replacement Sampling for Stochastic Gradient Methods

as the name of the paper suggests.

Fast and Provably Good Seedings for k-Means

provide fast and competitive seedings for k-Means clustering without prior assumptions on the data

Unsupervised Learning for Physical Interaction through Video Prediction

learn about physical object motion without labels

High-Rank Matrix Completion and Clustering under Self-Expressive Models
Learning a Probabilistic Latent Space of Object Shapes via 3D Generative-Adversarial Modeling

generate 3D objects

Visual Dynamics: Probabilistic Future Frame Synthesis via Cross Convolutional Networks

use a single input frame to generate future frames.

Human Decision-Making under Limited Time

Human decision-making practically is not optimal under constraints such as time.

Incremental Boosting Convolutional Neural Network for Facial Action Unit Recognition

Boosting CNN for facial action recognition.

Natural-Parameter Networks: A Class of Probabilistic Neural Networks

a bayesian treatment for NN, to alleviate the problem of insufficient data.

Tree-Structured Reinforcement Learning for Sequential Object Localization

existing object detection algorithms ignore interdependency among different objects and deviate from the human perception procedure

Unsupervised Domain Adaptation with Residual Transfer Networks

transfer learning

Verification Based Solution for Structured MAB Problems

mutli-armed bandit?

Minimizing Regret on Reflexive Banach Spaces and Nash Equilibria in Continuous Zero-Sum Games
Linear dynamical neural population models through nonlinear embeddings
SURGE: Surface Regularized Geometry Estimation from a Single Image

predict pixel depth in a image.

Interpretable Distribution Features with Maximum Testing Power

distinguish distributions

Sorting out typicality with the inverse moment matrix SOS polynomial
Multi-armed Bandits: Competing with Optimal Sequences
Multivariate tests of association based on univariate tests

Test the independence of two random vectors, convert multivariate test to univariate test by imposing a distance measure.

Learning What and Where to Draw

Sythesize images using GAN given what and where to draw.

The Sound of APALM Clapping: Faster Nonsmooth Nonconvex Optimization with Stochastic Asynchronous PALM

a block coordinate stochastic proximal-gradient method for solving nonconvex, nonsmooth optimization problems

Integrated perception with recurrent multi-task neural networks

multi-task learning

Learning from Small Sample Sets by Combining Unsupervised Meta-Training with CNNs
CNNpack: Packing Convolutional Neural Networks in the Frequency Domain

compressing CNN


This reporsitory is my worklog



No releases published


No packages published