Exporting the Dataset to Mona

In the fake dataset repo you have cloned earlier, you can find 3 ready-made export scripts (export_training_data.py, export_inference_time_data.py, and export_feedback_data.py). One for training and test data, one for inference data, and one for feedback data. We will use these scripts to export our data to Mona.

When exporting this data to Mona, besides the data itself, Mona requires a couple of other parameters.

contextClass - The context class usually relates to a single monitored AI system, which could include several models. You can think of it as the name of the monitoring data table. In our example, it is called LOAN_APPLICATION_TUTORIAL, since our AI system always runs in the context of a single loan application (and we want to make it clear it's used for the tutorial). For the purposes of this tutorial, we recommend using a unique temporary name for this context class in your account, to allow other users in the same environment to go through the tutorial as well. We recommend using

contextId - This is a unique identifier for a specific run of the system. You can think of it as the identifier of a row in the monitoring data table. In this case, we use the loan application id to identify the AI system’s run context.
You can export several JSON messages with the same contextId and Mona will understand they belong to the same system run and will merge them on the server-side. This is how Mona connects the feedback ground truth data with its already existing loan application, even when those are sent at very different times.

exportTimestamp - this tells Mona when the system run for this application took place. Using this parameter allows you to export data after the fact. If it is omitted, Mona will use the actual time the data was exported by default.


Now, let's set our API key and secret as variables in each of the scripts.


Step 1. Install Mona_sdk.

Before exporting the data, we need to install mona_sdk on our environment. This is done by typing "pip install mona_sdk" in our terminal.

Step 2. Export train and inference data.

Now that everything is set up, you can start exporting your data to Mona by running ONLY export_training_data and export_inference_time_data.

The export scripts are using our Mona open-source SDK to send the data to Mona.
In your terminal, type “python <script_name>“ to run the scripts and export your data.
Make sure to run the scripts from the mona-tuorial directory.

Context class
open-source SDK

Did this page help you?