Tag: 感知器

在哈希映射上运行perceptron算法functionvecteur:java

我有以下代码,它从目录中读取许多文件到哈希映射,这是我的functionvecteur 。 从某种意义上讲,它有点幼稚,但它并不是我现在主要关注的问题。 我想知道如何使用这种数据结构作为感知器算法的输入。 我猜我们称之为一袋话,不是吗? public class BagOfWords { static Map bag_of_words = new HashMap(); public static void main(String[] args) throws IOException { String path = “/home/flavius/atheism; File file = new File( path ); new BagOfWords().iterateDirectory(file); for (Map.Entry entry : bag_of_words.entrySet()) { System.out.println(entry.getKey()+” : “+entry.getValue()); } } private void iterateDirectory(File file) throws IOException { for […]