简体   繁体   中英

Python wrapper arround fasttext train with parameter tuning

I use Fasttext to do classification of toxic comments (the Kaggle competition). To train my model I run the command

fasttext supervised -input model_train.train -output model_tune -autotune-validation model_train.valid -autotune-modelsize 100M -autotune-duration 1200

which train a classification model and do parameters tuning while ensuring the size of the model is below 100M. Is there a python wrapper to train supervised model with -autotune-validation ? I know there is python wrapper for the predict and train method but couldn't find one to train classification models with autotune-validation . Also if on the top of that there is a sklearn wrapper that does the same thing that would be marvelous.

Thanks in advance

Yes, you can autotune it using Python by adding autotuneValidationFile parameter to the function.

Ref: https://fasttext.cc/docs/en/autotune.html

As explained here , python wrapper for fastText automatic hyperparameter optimization has the following syntax:

model_tune = fasttext.train_supervised (input='model_train.train', \
  autotuneValidationFile='model_train.valid', autotuneModelSize='100M', \
  autotuneDuration=1200)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM