Skip to content

Reference

The Comet MPM class is used to upload a model's input and output features to MPM

CometMPM.init

__init__(api_key: Optional[str] = None,
    workspace_name: Optional[str] = None,
    model_name: Optional[str] = None,
    model_version: Optional[str] = None,
    disabled: Optional[bool] = None, asyncio: bool = False)

Creates the Comet MPM Event logger object.

Args:

  • api_key: The Comet API Key
  • workspace_name: The Comet Workspace Name of the model
  • model_name: The Comet Model Name of the model
  • model_version: The Comet Model Version of the model
  • disabled: If set to True, CometMPM will not send anything to the backend.
  • asyncio: Set to True if you are using an Asyncio-based framework like FastAPI.

CometMPM.connect

connect() -> None

When using CometMPM in asyncio mode, this coroutine needs to be awaited at the server start.

CometMPM.join

join(timeout: Optional[int] = None) -> Optional[Awaitable[None]]

When using CometMPM in asyncio mode, this coroutine needs to be awaited at the server stop.

CometMPM.log_event

log_event(prediction_id: str, input_features: Optional[Dict[str,
    Any]] = None, output_value: Optional[Any] = None, output_probability: Optional[Any] = None) -> Optional[Awaitable[None]]

Log a single event asynchronously to MPM. Events are identified by the mandatory prediction_id parameter. You can send multiple events with the same prediction_id, events will be merged on the backend side automatically.

Args:

  • prediction_id: The unique prediction ID, could be provided by the framework, you or a random unique value could be provided like str(uuid4())
  • input_features: If provided must be a flat Dictionary where the keys are the feature name and the value are native Python scalars, int, floats, booleans or strings. For example: {“age”: 42, “income”: 42894.89}
  • output_value: The prediction as a native Python scalar, int, float, boolean or string.
  • output_probability: If provided, must be a float between 0 and 100 indicating the confidence of the model in the prediction
Nov. 27, 2022