LeaPI is a zero-shot leanring method to automatically Learn a classifier from human need descriptions with Prototypical Instantiation. It first automatically generates weak labels by instantiating high-level concepts with prototypical instances and then trains a human needs classifier with the weakly labeled data. To filter noisy concepts, it uses a reinforced selection algorithm to choose high-quality concepts for instantiation.
For more details, check out our paper Learning to Classify Events from Human Needs Category Descriptions.
conda create -n leapi -y python=3.7
conda activate leapi
./setup.sh
- GoogleNews-vectors-negative300.bin
Download and put it in
resources probase-data-concept-instance-relations.txtDownload Probase and put it inresourcesevent-dict.gzDownload event dictionary developed by Ding&Riloff Download linkevent-vecs.binDownload event embeddings. An event embeddings is the average of embeddings of words in the event. Download link.SemEval2015-English-Twitter-Lexicon.pos.jsonDownload twitter english sentiment lexicon.
- First
cd leapi - Run the following command
python main_learn.py --rl-max-epoch 200 --rl-sample-times 30 --rl-agent-lr 1e-3 --state-feat prodlabel --none-size 300 --wvfpath ../resources/GoogleNews-vectors-negative300.bin --seed 111 --rl-init default
The resources directory contains a pre-extracted candidate concepts. The user can also extract their own candidate concepts using the following scripts.
-
Install and start redis server ''' >> redis-server '''
-
Load
Probaseto redis
cd leapi/prepare-data/
python probase-redis-server.py python create_event_dict_redis_server.py-
Extract candidate concepts
cd leapi/concepts python generate_concept_candidates.py
