简体   繁体   English

deeplearning4j - 使用Word2Vec进行命名实体识别

[英]deeplearning4j - use Word2Vec for named entity recognition

I am trying to replicate the paper NLP (almost) from scratch using deeplearning4j. 我试图使用deeplearning4j 从头开始复制纸张NLP(差不多) I have done the following steps: 我已完成以下步骤:

  1. load the SENNA word vectors 加载SENNA字向量
  2. write a iterator for the CoNLL'03 dataset: for each word, I form a word feature vector by concatenating the word vectors of its neighbour words (with window size = 5) 为CoNLL'03数据集编写一个迭代器:对于每个单词,我通过连接其邻居单词的单词向量(窗口大小= 5)形成单词特征向量
  3. use the above dataset iterator to train a simple regression layer, for example: 使用上面的数据集迭代器来训练一个简单的回归层,例如:
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
    .seed(seed).iterations(iterations)
    .learningRate(1e-8f)
    .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
    .list(2)
    .layer(0, new DenseLayer.Builder()
        .nIn(wordVecLayers * windowSize).nOut(hiddenSize)
        .activation("relu")
        .weightInit(WeightInit.DISTRIBUTION)
        .dist(new UniformDistribution(-2.83 / Math.sqrt(hiddenSize), 2.83 / Math.sqrt(hiddenSize)))
        .biasInit(0.0f).build())
    .layer(1, new OutputLayer.Builder(LossFunction.NEGATIVELOGLIKELIHOOD)
        .nIn(hiddenSize).nOut(types.size())
        .activation("softmax").weightInit(WeightInit.DISTRIBUTION)
        .dist(new UniformDistribution(-2.83 / Math.sqrt(hiddenSize), 2.83 / Math.sqrt(hiddenSize)))
        .biasInit(0.0f).build())
    .backprop(true).pretrain(false)
    .build();

I have tried many different configurations but none of them worked for me. 我尝试了很多不同的配置,但没有一个适合我。 The model keep predicting all words with the 'O'-tag. 该模型使用'O'-tag预测所有单词。 I would appreciate if you can point out what's wrong with my approach? 如果你能指出我的方法有什么问题,我将不胜感激? And what steps I should do next? 接下来我应该采取什么措施? Thank you! 谢谢!

Our word2vec sentiment example is a good place to start: https://github.com/deeplearning4j/dl4j-0.4-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/recurrent/word2vecsentiment 我们的word2vec情绪示例是一个很好的起点: https//github.com/deeplearning4j/dl4j-0.4-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/recurrent/word2vecsentiment

This covers doing sequence labeling ove word vectors (which is also NER) 这包括对字向量进行序列标记(也是NER)

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

相关问题 Deeplearning4j Word2Vec 构建器种子 - Deeplearning4j Word2Vec builder seed deeplearning4j word2vec输出wordvectors - deeplearning4j word2vec output wordvectors WordVectorSerializer.loadTxtVectors()中的word2vec deeplearning4j ArrayIndexOutOfBoundsException - word2vec deeplearning4j ArrayIndexOutOfBoundsException in WordVectorSerializer.loadTxtVectors() 如何将Deeplearning4j Word2vec与Spark配合使用? - How can I use deeplearning4j Word2vec with Spark? 我在deeplearning4j中使用了word2vec来训练单词向量,但是这些向量是不稳定的 - I used word2vec in deeplearning4j to train word vectors, but those vectors are unstable 如何将Deeplearning4j word2vec与Spark合并以将单词转换为其向量表示形式? - How to incorporate Deeplearning4j word2vec with Spark to convert words into its vector representation? 我在deeplearning4j中使用了word2vec来训练向量,但结果不稳定 - I used the word2vec in deeplearning4j to train vectors, but results are unstable 如何清除DeepLearning4j Word2Vec中的vocab缓存,以便每次都对其进行重新培训 - How to clear vocab cache in DeepLearning4j Word2Vec so it will be retrained everytime 是否可以在deeplearning4j.word2vec中使用gensim word2vec模型? - Is it possible to use gensim word2vec model in deeplearning4j.word2vec? DeepLearning4J Doc2Vec 输入结构 - DeepLearning4J Doc2Vec input structure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM