Skip to content

[deprecated] reference code for fastText.py(python wrapper of fastText)

Notifications You must be signed in to change notification settings

dsindex/pyfastText_examples

Repository files navigation

pyfastText

  • description

    pip install fasttext
  • word vector

    • train
    python train_wordvec.py --train data.txt --model model --type=skipgram
    
    # you can adjust hyper-parameters by editing train_wordvec.py
    # for example,
    #   dim=100, epoch=5, ... 
    # data.txt is just a big text file like 'text9'
    • lookup
    python lookup_wordvec.py --model=model.bin
    facebook
    [-0.21015416085720062, 0.3572459816932678, ..., 0.40391290187835693, 0.2624731957912445]
  • classification

    • train
    python train_classifier.py --train=amazon_review_polarity.train --model=polarity
    
    # training files are downloadable via https://github.com/facebookresearch/fastText/blob/master/classification-results.sh 
    • evaluate
    python evaluate_classifier.py --model=polarity.bin --test=amazon_review_polarity.test
    P@1: 0.9110425
    Number of examples: 400000
    • predict
    python predict.py --model=polarity.bin
    bad design , the rubber/plastic material ripped within moments at two points where the volume and phone jacks meet .
    [u'__label__1']

About

[deprecated] reference code for fastText.py(python wrapper of fastText)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages