使用Python API的快速文本无监督模型丢失 [英] Fast Text unsupervised model loss with Python API
问题描述
在使用Python API和Fast Text进行模型的无监督训练时,有什么方法可以使模型丢失吗?目前,我正在使用C ++模型进行培训,并使用Python API进行加载.
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
但是,使用Python API进行相同操作:
However, doing the same using the Python API:
import fastText
model = fastText.train_unsupervised('/data/cleaned.txt',
epoch=12000,
minCount=2,
ws=3)
这是训练但不输出损失吗?我检查了训练功能选项中的详细级别verbosity=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?
推荐答案
如果您从外壳程序运行python脚本,它将打印所需的输出.
If you run the python script from the shell, it prints the desired output.
也许您正在使用Jupyter Notebook.在这种情况下,目前没有一种简单的方法可以在笔记本中查看输出.
Maybe you're using Jupyter Notebook. In this case, currently there's not a simple way to see the output in the notebook.
这篇关于使用Python API的快速文本无监督模型丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!