Class Doc2Vec
java.lang.Object
ai.beestream.jitnn.nn.Module
ai.beestream.jitnn.nn.models.Doc2Vec
- All Implemented Interfaces:
AutoCloseable
Paragraph vectors (Le and Mikolov, 2014) with negative sampling. PV-DBOW predicts the words of a
document from its vector alone; PV-DM predicts a word from the mean of the document vector and
the word vectors of its context.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDoc2Vec(int vocab, int documents, int dim, Doc2Vec.Mode mode, long seed) Paragraph vectors fordocumentsdocuments overvocabwords, vectors ofdim, trained asmodesays, initialised fromseed. -
Method Summary
Modifier and TypeMethodDescriptionintdim()The vector size.float[]All document vectors [documents, dim] on the host.The document vectors of ids x.loss(int[] documents, int[] targets, int[] contexts, int[] negatives, int k) The loss of a batch: document ids [B], the predicted words [B], for PV-DM the context words [B * window2] (null for PV-DBOW), and k negatives per sample.Methods inherited from class Module
buffer, buffers, child, close, isClosed, isTraining, loadStateDict, parameter, parameterCount, parameters, stateDict, train, zeroGrad
-
Constructor Details
-
Doc2Vec
Paragraph vectors fordocumentsdocuments overvocabwords, vectors ofdim, trained asmodesays, initialised fromseed.
-
-
Method Details
-
loss
The loss of a batch: document ids [B], the predicted words [B], for PV-DM the context words [B * window2] (null for PV-DBOW), and k negatives per sample. -
forward
-
documentVectors
public float[] documentVectors()All document vectors [documents, dim] on the host. -
dim
public int dim()The vector size.
-