mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Update Language API docs
This commit is contained in:
parent
9c975c4882
commit
77dca25c7f
|
@ -141,10 +141,10 @@ p
|
||||||
p Update the models in the pipeline.
|
p Update the models in the pipeline.
|
||||||
|
|
||||||
+aside-code("Example").
|
+aside-code("Example").
|
||||||
with nlp.begin_training(gold, use_gpu=True) as (trainer, optimizer):
|
for raw_text, entity_offsets in train_data:
|
||||||
for epoch in trainer.epochs(gold):
|
doc = nlp.make_doc(raw_text)
|
||||||
for docs, golds in epoch:
|
gold = GoldParse(doc, entities=entity_offsets)
|
||||||
state = nlp.update(docs, golds, sgd=optimizer)
|
nlp.update([doc], [gold], drop=0.5, sgd=optimizer)
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
+table(["Name", "Type", "Description"])
|
||||||
+row
|
+row
|
||||||
|
@ -173,17 +173,13 @@ p Update the models in the pipeline.
|
||||||
+cell Results from the update.
|
+cell Results from the update.
|
||||||
|
|
||||||
+h(2, "begin_training") Language.begin_training
|
+h(2, "begin_training") Language.begin_training
|
||||||
+tag contextmanager
|
+tag method
|
||||||
|
|
||||||
p
|
p
|
||||||
| Allocate models, pre-process training data and acquire a trainer and
|
| Allocate models, pre-process training data and acquire an optimizer.
|
||||||
| optimizer. Used as a contextmanager.
|
|
||||||
|
|
||||||
+aside-code("Example").
|
+aside-code("Example").
|
||||||
with nlp.begin_training(gold, use_gpu=True) as (trainer, optimizer):
|
optimizer = nlp.begin_training(gold_tuples)
|
||||||
for epoch in trainer.epochs(gold):
|
|
||||||
for docs, golds in epoch:
|
|
||||||
state = nlp.update(docs, golds, sgd=optimizer)
|
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
+table(["Name", "Type", "Description"])
|
||||||
+row
|
+row
|
||||||
|
@ -199,7 +195,7 @@ p
|
||||||
+footrow
|
+footrow
|
||||||
+cell yields
|
+cell yields
|
||||||
+cell tuple
|
+cell tuple
|
||||||
+cell A trainer and an optimizer.
|
+cell An optimizer.
|
||||||
|
|
||||||
+h(2, "use_params") Language.use_params
|
+h(2, "use_params") Language.use_params
|
||||||
+tag contextmanager
|
+tag contextmanager
|
||||||
|
|
Loading…
Reference in New Issue
Block a user