Vowpal Wabbit:未找到命令

2024-06-07 06:44:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在生成的文件上运行Vowpal Wabbit。 文件本身:

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))

由于我解决了分类问题,我将损失函数设置为铰链值(线性支持向量机)。我将构建的模型保存到相应的文件20news_model.vw中:

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

但这就是产生错误的地方。

/bin/sh: vw: command not found

我已经通过“conda install -c conda-forge vowpalwabbit”安装了VW


Tags: 文件textintesttargetfordatalabels
1条回答
网友
1楼 · 发布于 2024-06-07 06:44:25

您正在为VW安装Python绑定,然后尝试使用命令行界面

或者您需要安装命令行二进制文件。您可以找到从源代码here构建的说明。也可以在MacOS上使用brew

或者,您可以使用Python绑定来驱动学习者。你可以找到关于here的教程

相关问题 更多 >