add script to train classifier
fix some bugs