Multiclass Classification
Onboarding a Multiclass Classification Model
Suppose you would like to onboard a multiclass classification model for the following dataset.
Following is an example of how you would construct a fdl.ModelInfo
object and onboard such a model.
categorical_target_class_details
For multiclass models, the
categorical_target_class_details
argument is required.This argument should be a list of your target classes in the order that your model outputs predictions for them.
PROJECT_ID = 'example_project'
DATASET_ID = 'iris_data'
MODEL_ID = 'multiclass_model'
dataset_info = client.get_dataset_info(
project_id=PROJECT_ID,
dataset_id=DATASET_ID
)
model_task = fdl.ModelTask.MULTICLASS_CLASSIFICATION
model_target = 'species'
model_outputs = [
'probability_0',
'probability_1',
'probability_2'
]
model_features = [
'sepal_length',
'sepal_width',
'petal_length',
'petal_width'
]
model_info = fdl.ModelInfo.from_dataset_info(
dataset_info=dataset_info,
dataset_id=DATASET_ID,
target=model_target,
outputs=model_outputs,
model_task=model_task,
categorical_target_class_details=[0, 1, 2]
)
client.add_model(
project_id=PROJECT_ID,
dataset_id=DATASET_ID,
model_id=MODEL_ID,
model_info=model_info
)
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.
Updated 2 months ago
For information on how to construct a package.py for Multiclass Classification check the following: