Skip to content

Model

Importing the necessary modules

Next you are required to import model to use functions involved in this module.

from aiaengine.api import model

Creating a model

Now you can create a model for a given feature set by specifying parameter values as follows

create_model_response = client.models.CreateModel(
    model.CreateModelRequest(
        app_id='id_of_app_where_model_is_attached',
        feature_set_id='id_of_feature_set_where_model_is_attached',
        name='Model Name',
        template_id='id_of_template_supported_in_platform',
        hyperparameters='{}',   # default values
        evaluation=model.ModelEvaluation(
            metric='f1_macro',    # metric used for hyperparameter tuning
            threshold=0.9,
            min_feedback_count=0.0        
        )
    )
)

Once created, a model is assigned with a unique id, which is frequently used in relevant functions.

model_id = create_model_response.id

Retriving information of a model

You can get information of a model if providing the model id.

client.models.GetModel(
    model.GetModelRequest(
        id='id_of_model'
    )
)

Updating a model

You can also modify the model by specifying the model id.

client.models.UpdateModel(
    model.UpdateModelRequest(
        id='id_of_updated_models',
        name='Updated Model',
        evaluation=model.ModelEvaluation(
            metric='accuracy',    # metric used for hyperparameter tuning
            threshold=0.9,
            min_feedback_count=0.0
        )
    )
)

Deleting a models_listing_page_training

If a model is no longer in use, you can remove it with input of the model id.

client.models.DeleteModel(
    model.DeleteModelRequest(
        id='id_of_deleted_model'
    )
)

Listing models in an app

For a particular app, you can check and list all models by giving the app id.

client.models.ListModels(
    model.ListModelsRequest(
        app_id='id_of_app_where_models_are_included'
    )
)