public class MentionTagger extends Tagger
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
protected Class<? extends Tag> |
tagset |
protected String |
type |
protected int |
workers |
batchSize, embeddingLayerSize, embeddingVectorSize, inputVectorSize, maxTimeSeriesLength, net, numEpochs, numExamples, outputVectorSize, randomizeid, model, modelAvailable, name, timer| Constructor and Description |
|---|
MentionTagger() |
MentionTagger(AbstractIterator data,
int ffwLayerSize,
int lstmLayerSize,
int iterations,
double learningRate) |
MentionTagger(String id) |
| Modifier and Type | Method and Description |
|---|---|
static org.deeplearning4j.nn.graph.ComputationGraph |
createBLSTM(long inputVectorSize,
long ffwLayerSize,
long lstmLayerSize,
long outputVectorSize,
int iterations,
double learningRate) |
static void |
createTags(Iterable<Sentence> sents,
org.nd4j.linalg.api.ndarray.INDArray predicted,
Class tagset,
Annotation.Source source,
String type,
boolean keepVectors,
boolean convertTags)
Creates BIO2Tags from predictions.
|
void |
enableTrainingUI() |
EncoderSet |
getEncoderSet()
Deprecated.
|
Class<? extends Tag> |
getTagset() |
String |
getType() |
MentionTagger |
setModelParams(int ffwLayerSize,
int lstmLayerSize,
int iterations,
double learningRate) |
MentionTagger |
setTagset(Class<? extends Tag> tagset) |
MentionTagger |
setTagset(Class<? extends Tag> tagset,
String types) |
MentionTagger |
setTrainingParams(int batchSize,
int numEpochs,
boolean randomize) |
void |
setType(String type) |
MentionTagger |
setWorkspaceParams(int workers) |
void |
tag(Collection<Document> documents)
Predicts labels for all Tokens in the Iterator and assigns Tags (BIO2 or BIOES).
|
void |
tagSentences(Collection<Sentence> sentences) |
org.nd4j.evaluation.classification.Evaluation |
test(MentionTaggerIterator it) |
void |
testModel(Dataset dataset,
Annotation.Source expected)
requires: GOLD BIO2Tag.class and BIOESTag.class for Token.class
attaches: PRED BIO2Tag.class and BIOESTag.class to Token.class
|
void |
trainModel(Collection<Sentence> sentences,
Annotation.Source trainingTags,
boolean randomize) |
void |
trainModel(Dataset dataset) |
void |
trainModel(Dataset dataset,
Annotation.Source trainingAnnotations) |
void |
trainModel(Dataset dataset,
Annotation.Source trainingAnnotations,
int numExamples,
boolean randomize) |
protected void |
trainModel(MentionTaggerIterator it) |
getBatchSize, getEmbeddingLayerSize, getEncoders, getGraphConfiguration, getLayerConfiguration, getMaxTimeSeriesLength, getNN, getNumEpochs, isModelAvailableInChildren, isRandomize, loadConf, loadModel, saveModel, saveUpdater, setBatchSize, setEmbeddingLayerSize, setEncoders, setGraphConfiguration, setLayerConfiguration, setListeners, setMaxTimeSeriesLength, setNumEpochs, setRandomize, setTrainingParams, tag, testModelappendTestLog, appendTestLog, appendTrainLog, appendTrainLog, clearTestLog, clearTrainLog, getConf, getId, getModel, getName, getTestLog, getTrainLog, isModelAvailable, setConf, setId, setModel, setModelAvailable, setModelFilename, setNameprotected static final org.slf4j.Logger log
protected int workers
protected String type
public MentionTagger()
public MentionTagger(String id)
public MentionTagger(AbstractIterator data, int ffwLayerSize, int lstmLayerSize, int iterations, double learningRate)
public MentionTagger setModelParams(int ffwLayerSize, int lstmLayerSize, int iterations, double learningRate)
public static org.deeplearning4j.nn.graph.ComputationGraph createBLSTM(long inputVectorSize,
long ffwLayerSize,
long lstmLayerSize,
long outputVectorSize,
int iterations,
double learningRate)
public String getType()
public void setType(String type)
public MentionTagger setTagset(Class<? extends Tag> tagset)
public MentionTagger setTagset(Class<? extends Tag> tagset, String types)
public MentionTagger setTrainingParams(int batchSize, int numEpochs, boolean randomize)
public MentionTagger setWorkspaceParams(int workers)
@Deprecated public EncoderSet getEncoderSet()
public void trainModel(Dataset dataset)
trainModel in class Taggerpublic void trainModel(Dataset dataset, Annotation.Source trainingAnnotations)
public void trainModel(Dataset dataset, Annotation.Source trainingAnnotations, int numExamples, boolean randomize)
public void trainModel(Collection<Sentence> sentences, Annotation.Source trainingTags, boolean randomize)
protected void trainModel(MentionTaggerIterator it)
public void tag(Collection<Document> documents)
public void tagSentences(Collection<Sentence> sentences)
public void testModel(Dataset dataset, Annotation.Source expected)
dataset - expected - public org.nd4j.evaluation.classification.Evaluation test(MentionTaggerIterator it)
public void enableTrainingUI()
public static void createTags(Iterable<Sentence> sents, org.nd4j.linalg.api.ndarray.INDArray predicted, Class tagset, Annotation.Source source, String type, boolean keepVectors, boolean convertTags)
sents - List of sentences to tag.predicted - Predictions from the sequence model.tagset - The tagset to use for tagging (e.g. BIOES). Output will be transformed to BIOES then.source - Which tags to use: GOLD, PREDICTED or USER.keepVectors - If TRUE, vectors are not deleted from the Tokens.convertTags - If TRUE, tags are corrected and converted to BIO2. Otherwise, we keep Tags of class tagset.Copyright © 2020. All rights reserved.