Skip to content

Model

This section shows how to create, modify and list models for an app in AI & Analytics Engine using

  • Using the GUI
  • Using API access through SDK

Using the GUI

Creating a model in an app

There are two ways to add new models. One is by clicking the "NEW MODEL" rectangle in the dashboard. The second is by entering the "Sample App" menu and hovering on the lower right '+'. The hovering will expand into two options, one of which is "TRAIN NEW MODEL". After clicking on it, the "model recommendation" menu will open.

Example:

  • First method:

  • Second method:

After choosing one of the methods, the model recommendation menu opens:

Suppose we select three models and proceed to training by clicking "NEXT" and following the prompts. You will initially see the following which means that you have three models undergoing training.:

Retrieving information of a model

When a model has finished training it will have a green "READY" marker on it. You can retrieve information about the model when it's in the "READY" state.

Clicking on the finished model we will enter into the model Summary page where many useful metrics and visualizations are available. Please see the "Obtaining Evaluation Results" section for more details.

Updating a model

To update the model name, select the "SETTINGS" tab in the tabs ribbon. It will open the update menu. Change the model name and select "SAVE".

Deleting a models

To delete a model, select the garbage bin icon in the tabs ribbon on the rightmost are. It will open the delete menu. Verify the deletion by typing in delete and then press the "delete" button.

Listing models in an app

To list all models, return to the Dashboard and notice that the app is connected to a dataset, and the dataset is connected to a list of models.

Using API access through SDK

To access the API functions, you must first authenticate into the platform by

from aiaengine import api

client = api.Client()

Importing model

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

from aiaengine.api import model

Creating a model in an app

Now you can create a model within an app by specifying parameter values as follows.

create_model_response = client.models.CreateModel(
    model.CreateModelRequest(
        app_id='id_of_app_model_is_created_for',
        name='Model Name',
        template_id='id_of_template_supported_in_platform',
        hyperparameters='{}',   # default values
        evaluation=model.ModelEvaluation(
            metric='f1_macro',    # metric used to evaluate model
            threshold=0.9,
            min_feedback_count=0.0,
            auto_retrain=False
        )
    )
)

model_id = create_model_response.id

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

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 to evaluate updated model
            threshold=0.9,
            min_feedback_count=0.0,
            auto_retrain=False
        )
    )
)

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'
    )
)