简体   繁体   English

带有二进制分类器的Firefox附加组件

[英]Firefox add-on with binary classifier

As an experiment, I want to use mljs/naive-bayes classifier in my Firefox add-on. 作为实验,我想在我的Firefox插件中使用mljs / naive-bayes分类器。 Before the classifier can be useful, it has to be trained first. 在分类器变得有用之前,必须先对其进行训练。 In my case, I'll be training it using an array of 20000 entries. 就我而言,我将使用20000个条目的数组对其进行训练。

The entries come from a text file in the add-on's directory. 这些条目来自加载项目录中的文本文件。 I already have working code that reads the text file and trains the classifier using the data. 我已经有可以读取文本文件并使用数据训练分类器的工作代码。

As much as possible though, training should not occur on the user side for performance reasons. 但是,出于性能方面的考虑,不应在用户端进行尽可能多的培训。 How do I make it such that the add-on comes pre-packaged with a trained classifier? 我该如何使附加组件预先包装有训练有素的分类器?

I understand that mljs/naive-bayes has an export() function which returns the classifier as a Javascript object. 我知道mljs / naive-bayes具有export()函数,该函数将分类器作为Javascript对象返回。 I have no idea what to do from there, though. 不过,我不知道该怎么办。

It also has a load(model) function to load the model you exported. 它还具有load(model)函数,以加载导出的模型。 So, you: 那么你:

  1. train the classifier on your own, 自己训练分类器,
  2. call export , 致电export
  3. package the exported model with your addon, 将导出的模型与您的插件打包在一起,
  4. and call load from it. 并从中调用load

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

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