docs/api/tutorials/mlmodel-mlmodelgroup.md
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
MLModel and MLModelGroup entities are used to represent machine learning models and their associated groups within a metadata ecosystem. They allow users to define, manage, and monitor machine learning models, including their versions, configurations, and performance metrics.
This guide will show you how to
For this tutorial, you need to deploy DataHub Quickstart and ingest sample data. For detailed steps, please refer to DataHub Quickstart Guide.
You can create an MLModelGroup by providing the necessary attributes such as name, platform, and other metadata.
{{ inline /metadata-ingestion/examples/library/mlmodel_group_create.py show_path_as_comment }}
You can create an MLModel by providing the necessary attributes such as name, platform, and other metadata.
{{ inline /metadata-ingestion/examples/library/mlmodel_create_full.py show_path_as_comment }}
Note that you can associate an MLModel with an MLModelGroup by providing the group URN when creating the MLModel.
You can also set MLModelGroup later by updating the MLModel entity as shown below.
{{ inline /metadata-ingestion/examples/library/mlgroup_add_to_mlmodel.py show_path_as_comment }}
You can read an MLModelGroup by providing the group URN.
{{ inline /metadata-ingestion/examples/library/mlmodel_group_read.py show_path_as_comment }}
>> Model Group Name: My Recommendations Model Group
>> Model Group Description: A group for recommendations models
>> Model Group Custom Properties: {'owner': 'John Doe', 'team': 'recommendations', 'domain': 'marketing'}
You can read an MLModel by providing the model URN.
{{ inline /metadata-ingestion/examples/library/mlmodel_read.py show_path_as_comment }}
>> Model Name: My Recommendations Model
>> Model Description: A model for recommending products to users
>> Model Group: urn:li:mlModelGroup:(urn:li:dataPlatform:mlflow,my-recommendations-model,PROD)
>> Model Hyper Parameters: [MLHyperParamClass({'name': 'learning_rate', 'description': None, 'value': '0.01', 'createdAt': None}), MLHyperParamClass({'name': 'num_epochs', 'description': None, 'value': '100', 'createdAt': None}), MLHyperParamClass({'name': 'batch_size', 'description': None, 'value': '32', 'createdAt': None})]