Add Evaluation Records

The previous section covered how to register an evaluation recorder. This guide covers using this recorder to add individual records to a MarkovML evaluation recording. Model evaluation is done either at the end of the training or offline later. We support both modes.

circle-info

We send the records to the MarkovML backend asynchronously using multiple worker threads.

Adding Evaluation Record to Recorder

Evaluation Recorder accepts records of type SingleTagInferenceRecordarrow-up-right.

The pseudo-code looks like this

  1. Create a SingleTagInferenceRecord

from markov.api.schemas.model_recording import SingleTagInferenceRecord,RecordMetaType
from markov import EvaluationRecorder

evaluation_recorder = EvaluationRecorder(
    name=f"Evaluating model YOUR_MODEL_NAME",
    notes=f"Testing evaluation with MarkovML",
    model_id="YOUR_MODEL_ID"  # or my_model.model_id
)
# This method registers a recorder with Markov for the backend to process the records
# sent by this recorder. 
evaluation_recorder.register()

Single Record Prediction

  1. Go over your validation records

  2. Generate model Prediction

  3. Create SingleTagInferenceRecord

  4. Add the record to the recorder

Handing Batch Predictions

  1. Do batch Predictions

  2. Go over predictions, and for each prediction, generate SingleTagInferenceRecord

  3. Add the record to the recorder

Sending Custom Metric With Each Record

You can also add any custom_metric to your record for bookkeeping. Custom metrics are business metrics that you can include for further analysis. For example, if your business has low latency requirements, you might want to capture inference time as a custom metric to evaluate performance.

Note that custom metrics should be numeric.

Sending additional metadata with each record

In addition, you can also send additional metadata with each record for future analysis. For example, you might want to send all the probabilities generated by the soft-max classifier for different classes. The supported meta_types are herearrow-up-right.

Last updated