我在python中尝试这个Naive Bayes分类器:
classifier = nltk.NaiveBayesClassifier.train(train_set)
print "Naive Bayes Accuracy " + str(nltk.classify.accuracy(classifier, test_set)*100)
classifier.show_most_informative_features(5)
Run Code Online (Sandbox Code Playgroud)
我有以下输出:
可以清楚地看到哪些单词更多地出现在"重要"中,哪些出现在"垃圾邮件"类别中.但我无法使用这些值.我实际上想要一个如下所示的列表:
[[pass,important],[respective,spam],[investment,spam],[internet,spam],[understands,spam]]
Run Code Online (Sandbox Code Playgroud)
我是python的新手并且很难搞清楚所有这些,有人可以帮忙吗?我会非常感激的.
我正在使用laravel的默认通知系统.表的类型列由完整的类路径填充,如"App\Notifications\Upvoted".我只是自己填写数据列,如下所示:
public function toDatabase($notifiable)
{
return [
"post" => $this->post,
"user" => Auth::user()
];
}
Run Code Online (Sandbox Code Playgroud)
如何为"类型"列添加自定义值.
由于我是Laravel的新手,我们将非常感谢您的帮助.