INNER CODE UNIT · Python
_train_model
dragondrop-cloud/cloud-concierge · nlpengine/main.py:192
def _train_model(
nlp: spacy.Language,
textcat_multilabel_model,
training_data: List[Example],
evaluation_data: List[Example],
) -> dict:
"""
Divides the training data into sets of 10 and updates the model using them.
After each training batch, output the loss, as well as evaluate the accuracy on the evaluation
data set set.
Outputs a dict of the final loss and recall, precision and f1-score on the evaluation data set.
"""
optimizer = nlp.create_optimizer()
training_batches = np.array_split(training_data, 10)
for i, batch in enumerate(training_batches):