Fast Text unsupervised model loss with Python API

拥有回忆 提交于 2019-12-13 03:46:09

问题


Is there any way to get the model loss for the unsupervised training of models using Fast Text with the python API? At the moment I am doing the training using the C++ model and loading it using the Python API.

For e.g., I first run the following code to tweak hyper parameters

./fasttext skipgram \
-input /data/cleaned.txt \
-output /models/cleaned-model \
-epoch 12000 \
-minCount 2 \
-ws 3

The command-line interface gives an estimate of the loss like so:

Progress: 100.0% words/sec/thread:  103006 lr:  0.000000 loss:  1.803622 ETA:   0h 0m

However, doing the same using the Python API:

import fastText
model = fastText.train_unsupervised('/data/cleaned.txt', 
                                    epoch=12000, 
                                    minCount=2, 
                                    ws=3)

This trains but does not output the loss? I checked increasing the verbosity level verbosity=3 in the training function options but nothing happens. Is this a missing feature or something I am missing?


回答1:


If you run the python script from the shell, it prints the desired output.

Maybe you're using Jupyter Notebook. In this case, currently there's not a simple way to see the output in the notebook.



来源:https://stackoverflow.com/questions/54773706/fast-text-unsupervised-model-loss-with-python-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!