label = 1; } else { nextRandom = incrementRandom(nextRandom); target = table[(int) (((nextRandom >> 16) % TABLE_SIZE) + TABLE_SIZE) % TABLE_SIZE]; if (target == 0)
NeuralNetworkTrainer(NeuralNetworkConfig config, Multiset<String> vocab, Map<String, HuffmanNode> huffmanNodes, TrainingProgressListener listener) { this.config = config; this.huffmanNodes = huffmanNodes; this.listener = listener; this.vocabSize = huffmanNodes.size(); this.numTrainedTokens = vocab.size(); this.layer1_size = config.layerSize; this.window = config.windowSize; this.actualWordCount = new AtomicInteger(); this.alpha = config.initialLearningRate; this.syn0 = new double[vocabSize][layer1_size]; this.syn1 = new double[vocabSize][layer1_size]; this.syn1neg = new double[vocabSize][layer1_size]; this.table = new int[TABLE_SIZE]; initializeSyn0(); initializeUnigramTable(); }
model = neuralNetworkConfig.createTrainer(vocab, huffmanNodes, listener).train(sentences);
int i = 0; for (final List<List<String>> batch : partitioned) { tasks.add(createWorker(i, iter, batch)); i++;
model = neuralNetworkConfig.createTrainer(vocab, huffmanNodes, listener).train(sentences);
int i = 0; for (final List<List<String>> batch : partitioned) { tasks.add(createWorker(i, iter, batch)); i++;
NeuralNetworkTrainer(NeuralNetworkConfig config, Multiset<String> vocab, Map<String, HuffmanNode> huffmanNodes, TrainingProgressListener listener) { this.config = config; this.huffmanNodes = huffmanNodes; this.listener = listener; this.vocabSize = huffmanNodes.size(); this.numTrainedTokens = vocab.size(); this.layer1_size = config.layerSize; this.window = config.windowSize; this.actualWordCount = new AtomicInteger(); this.alpha = config.initialLearningRate; this.syn0 = new double[vocabSize][layer1_size]; this.syn1 = new double[vocabSize][layer1_size]; this.syn1neg = new double[vocabSize][layer1_size]; this.table = new int[TABLE_SIZE]; initializeSyn0(); initializeUnigramTable(); }
label = 1; } else { nextRandom = incrementRandom(nextRandom); target = table[(int) (((nextRandom >> 16) % TABLE_SIZE) + TABLE_SIZE) % TABLE_SIZE]; if (target == 0)
for (int c = 0; c < layer1_size; c++) neu1e[c] = 0; nextRandom = incrementRandom(nextRandom);
for (int c = 0; c < layer1_size; c++) neu1e[c] = 0; nextRandom = incrementRandom(nextRandom);
neu1e[c] = 0; nextRandom = incrementRandom(nextRandom); int b = (int)((nextRandom % window) + window) % window;
neu1e[c] = 0; nextRandom = incrementRandom(nextRandom); int b = (int)((nextRandom % window) + window) % window;