public class ParVecEncoder extends LookupCacheEncoder
| Modifier and Type | Field and Description |
|---|---|
protected int |
batchSize |
protected int |
iterations |
protected List<org.deeplearning4j.models.word2vec.VocabWord> |
labelsList |
protected int |
layerSize |
protected double |
learningRate |
protected static org.slf4j.Logger |
log |
protected double |
minLearningRate |
protected org.deeplearning4j.models.paragraphvectors.ParagraphVectors |
model |
protected int |
numEpochs |
protected static org.deeplearning4j.text.tokenization.tokenizer.TokenPreProcess |
preprocessor |
protected List<String> |
stopwords |
protected int |
targetSize |
protected org.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory |
tokenizerFactory |
protected int |
windowSize |
protected org.deeplearning4j.models.embeddings.wordvectors.WordVectors |
word2Vec |
totalWords, vocabid, modelAvailable, name, timer| Constructor and Description |
|---|
ParVecEncoder() |
| Modifier and Type | Method and Description |
|---|---|
org.nd4j.linalg.api.ndarray.INDArray |
encode(Annotation ann,
Document doc) |
org.nd4j.linalg.api.ndarray.INDArray |
encode(Span span) |
org.nd4j.linalg.api.ndarray.INDArray |
encode(String text) |
long |
getEmbeddingVectorSize() |
int |
getIndex(String word) |
int |
getInputVectorSize() |
String |
getNearestNeighbour(org.nd4j.linalg.api.ndarray.INDArray v) |
Collection<String> |
getNearestNeighbours(org.nd4j.linalg.api.ndarray.INDArray v,
int k) |
long |
getOutputVectorSize() |
org.nd4j.linalg.api.ndarray.INDArray |
getPredictions(org.nd4j.linalg.api.ndarray.INDArray v) |
int |
getTotalWords() |
String |
getWord(int index) |
List<String> |
getWords() |
static ParVecEncoder |
load(Resource path) |
void |
loadModel(Resource modelFile) |
org.nd4j.linalg.api.ndarray.INDArray |
oneHot(String word) |
void |
saveModel(Resource modelPath,
String name) |
void |
setModelParams(int layerSize,
int windowSize) |
void |
setStopWords(List<String> words) |
void |
setTrainingParams(double learningRate,
double minLearningRate,
int batchSize,
int iterations,
int numEpochs) |
void |
trainModel(Collection<Document> documents) |
void |
trainModel(Dataset train) |
ParVecEncoder |
withWordEmbedding(org.deeplearning4j.models.embeddings.wordvectors.WordVectors word2Vec) |
getConfidence, getFrequency, getMaxConfidence, getNearestNeighbours, getProbability, isUnknown, setTotalWordsencode, encodeEach, encodeEach, encodeEach, encodeMatrix, trainModelappendTestLog, appendTestLog, appendTrainLog, appendTrainLog, clearTestLog, clearTrainLog, getConf, getId, getModel, getName, getTestLog, getTrainLog, isModelAvailable, isModelAvailableInChildren, setConf, setId, setModel, setModelAvailable, setModelFilename, setNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEncoders, getId, getName, isModelAvailable, setEncodersprotected static final org.slf4j.Logger log
protected org.deeplearning4j.models.embeddings.wordvectors.WordVectors word2Vec
protected org.deeplearning4j.models.paragraphvectors.ParagraphVectors model
protected double learningRate
protected double minLearningRate
protected int batchSize
protected int numEpochs
protected int iterations
protected int layerSize
protected int targetSize
protected int windowSize
protected static final org.deeplearning4j.text.tokenization.tokenizer.TokenPreProcess preprocessor
protected final org.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory tokenizerFactory
protected List<org.deeplearning4j.models.word2vec.VocabWord> labelsList
public ParVecEncoder withWordEmbedding(org.deeplearning4j.models.embeddings.wordvectors.WordVectors word2Vec)
public void setModelParams(int layerSize,
int windowSize)
public void setTrainingParams(double learningRate,
double minLearningRate,
int batchSize,
int iterations,
int numEpochs)
public void trainModel(Collection<Document> documents)
trainModel in class Encoderpublic void trainModel(Dataset train)
public org.nd4j.linalg.api.ndarray.INDArray encode(Span span)
public org.nd4j.linalg.api.ndarray.INDArray encode(Annotation ann, Document doc)
public org.nd4j.linalg.api.ndarray.INDArray encode(String text)
public void saveModel(Resource modelPath, String name)
saveModel in interface IComponentsaveModel in class LookupCacheEncoderpublic static ParVecEncoder load(Resource path) throws IOException
IOExceptionpublic void loadModel(Resource modelFile) throws IOException
loadModel in interface IComponentloadModel in class LookupCacheEncoderIOExceptionpublic List<String> getWords()
getWords in class LookupCacheEncoderpublic int getTotalWords()
getTotalWords in class LookupCacheEncoderpublic long getEmbeddingVectorSize()
getEmbeddingVectorSize in interface IEncodergetEmbeddingVectorSize in class LookupCacheEncoderpublic long getOutputVectorSize()
public int getInputVectorSize()
public String getWord(int index)
getWord in class LookupCacheEncoderpublic int getIndex(String word)
getIndex in class LookupCacheEncoderpublic org.nd4j.linalg.api.ndarray.INDArray oneHot(String word)
oneHot in class LookupCacheEncoderpublic String getNearestNeighbour(org.nd4j.linalg.api.ndarray.INDArray v)
getNearestNeighbour in class LookupCacheEncoderpublic Collection<String> getNearestNeighbours(org.nd4j.linalg.api.ndarray.INDArray v, int k)
getNearestNeighbours in class LookupCacheEncoderpublic org.nd4j.linalg.api.ndarray.INDArray getPredictions(org.nd4j.linalg.api.ndarray.INDArray v)
Copyright © 2019. All rights reserved.