简体   繁体   English

Vowpal Wabbit:找不到命令

[英]Vowpal Wabbit: command not found

I want to run Vowpal Wabbit on the generated file.我想在生成的文件上运行 Vowpal Wabbit。 The file itself:文件本身:

all_documents = newsgroups['data']
all_targets = [1 if newsgroups['target_names'][target] == 'rec.autos' 
                 else -1 for target in newsgroups['target']]

train_documents, test_documents, train_labels, test_labels = \
                                 train_test_split(all_documents, all_targets, random_state=7)

with open('20news_train.vw', 'w') as vw_train_data:
    for text, target in zip(train_documents, train_labels):
        vw_train_data.write(to_vw_format(text, target))

with open('20news_test.vw', 'w') as vw_test_data:
    for text in test_documents:
        vw_test_data.write(to_vw_format(text))

Since I solve the classification problem, I set the loss function to the hinge value (linear SVM).由于我解决了分类问题,因此我将损失 function 设置为铰链值(线性 SVM)。 I save the constructed model to the corresponding file 20news_model.vw:我将构造好的model保存到对应的文件20news_model.vw中:

!vw -d 20news_train.vw --loss_function hinge -f 20news_model.vw

But this is where the error comes out.但这就是错误出现的地方。

/bin/sh: vw: command not found

I've installed VW via " conda install -c conda-forge vowpalwabbit ".我已经通过“ conda install -c conda-forge vowpalwabbit ”安装了 VW。

You're installing the Python bindings for VW and then trying to use the command line interface.您正在为大众安装 Python 绑定,然后尝试使用命令行界面。

Either you'll need to install the command line binary.您需要安装命令行二进制文件。 You can find instructions for building from sourcehere .您可以在此处找到从源代码构建的说明。 Or you can use brew on MacOS.或者您可以在 MacOS 上使用 brew。

Or, you can use the Python bindings to drive the learner.或者,您可以使用 Python 绑定来驱动学习者。 You can find a tutorial for that here你可以在这里找到一个教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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