Onboarding a Model

To onboard a model without uploading your model artifact, you can use the client.add_model() Python client. Let's walk through a simple example of how this can be done.


📘

Note

Using client.add_model() does not provide Fiddler with a model artifact. Onboarding a model in this fashion is a good start for model monitoring, but Fiddler will not be able to offer model explainability features without a model artifact. You can subsequently call client.add_model_surrogate() or client.add_model_artifact() to provide Fiddler with a model artifact. Please see Uploading a Model Artifact for more information.

Suppose you have uploaded the following baseline dataset, and you’ve created a fdl.DatasetInfo() object for it called dataset_info (See Uploading a Baseline Dataset).

PROJECT_ID = 'example_project'
DATASET_ID = 'example_dataset'

dataset_info = client.get_dataset_info(
    project_id=PROJECT_ID,
    dataset_id=DATASET_ID
)

Although the data has been uploaded to Fiddler, there is still no specification for which columns to use for which purpose.

Creating a ModelInfo object

To provide this specification, you can create a fdl.ModelInfo() object.

In this case, we’d like to tell Fiddler to use

  • feature_1, feature_2, and feature_3 as features
  • output_column as the model output
  • target_column as the model's target/ground truth

Further you want to specify the model task type. To save time, Fiddler provides a function to add this specification to an existing fdl.DatasetInfo() object.

model_task = fdl.ModelTask.BINARY_CLASSIFICATION
model_target = 'target_column'
model_outputs = ['output_column']
model_features = [
    'feature_1',
    'feature_2',
    'feature_3'
]

model_info = fdl.ModelInfo.from_dataset_info(
    dataset_info=dataset_info,
    dataset_id=DATASET_ID,
    features=model_features,
    target=model_target,
    outputs=model_outputs,
    model_task=model_task
)

The fdl.ModelInfo.from_dataset_info() function allows you to specify a fdl.DatasetInfo() object along with some extra specification and it will automatically generate your fdl.ModelInfo() object for you.

Onboarding your model

Once you have your fdl.ModelInfo() object, you can call client.add_model() to onboard your model with Fiddler.

MODEL_ID = 'example_model'

client.add_model(
    project_id=PROJECT_ID,
    dataset_id=DATASET_ID,
    model_id=MODEL_ID,
    model_info=model_info
)

What’s Next

Look at specific examples of model onboarding for different model task types within this section.