API Reference

readout_sketch

monad.ui.module.readout_sketch

monad.ui.module.readout_sketch(predictions_file, checkpoint_path)

Generates a dictionary mapping recommended entity ids to their scores.

from monad.ui.module import readout_sketch


# declare variables
# path to recommendation model checkpoints
checkpoint_path = "<path/to/downstream/model/checkpoints>"

# path to encoded predictions file
predictions_file = "<path/to/predictions/my_predictions.tsv>"

# get a generator yielding entity id and all scored products
sketch_readout_generator = readout_sketch(
    predictions_file=predictions_file,
    checkpoint_path=checkpoint_path,
)
Parameters

predictions_file: str
Saved predictions using OutputType.ENCODED.


checkpoint_path: str
Path to saved model checkpoint.


Returns

Iterable[tuple[str, np.ndarray]], generator yielding entity id and all scored products.