Skip to content

Model

This section shows how to create, modify and list models in AI & Analytics Engine using the Python SDK

Creating a model

Refer the Training models guide to know how to create new models using the SDK.

Retrieving information of a model

You can get information about a model by providing the model ID.

from aiaengine import Model

model_id = '' # set your own model ID
model = Model(id=model_id)
print(model.name)
package com.aiaengine.examples.model;

import com.aiaengine.Engine;
import com.aiaengine.Model;
import com.aiaengine.Org;

import java.io.FileNotFoundException;

public class GetModelApp {
    public static void main(String[] args) throws FileNotFoundException {
        Engine engine = new Engine();
        //replace with your model id
        Model model = engine.getModel("9310c78a-3970-457f-afea-6e2e2545eb7b");
        System.out.println(model.getName());
    }
}

Updating a model

You can modify the name and description of an existing model using the update() method.

from aiaengine import Model

model = Model(id='0dd8ad30-0744-4aac-9cd6-1b7cf749c089')

# update name of the model
model.update(name='XGBoost - Updated')
package com.aiaengine.examples.model;

import com.aiaengine.Engine;
import com.aiaengine.Model;

import java.io.FileNotFoundException;

public class UpdateModelApp {
    public static void main(String[] args) throws FileNotFoundException {
        Engine engine = new Engine();
        //replace with your model id
        Model model = engine.getModel("");
        model.update("Updated name");
    }
}

Listing models in an app

You can list all the models within an app using the following code

from aiaengine import App

app_id = ''
app = App(id=app_id)

models = app.list_models()
print(models)
package com.aiaengine.examples.model;

import com.aiaengine.App;
import com.aiaengine.Engine;
import com.aiaengine.Model;

import java.io.FileNotFoundException;
import java.util.List;

public class ListModelsApp {
    public static void main(String[] args) throws FileNotFoundException {
        Engine engine = new Engine();
        //replace with your app id
        App app = engine.getApp("");
        List<Model> models = app.listModels();
        models.forEach(model -> System.out.println(model.getName()));
    }
}

Deleting a model

You can also remove a model which is no longer needed using the delete() method

from aiaengine import Model

model_id = '' # set your own model ID
model = Model(id=model_id)
model.delete()
package com.aiaengine.examples.model;

import com.aiaengine.Engine;
import com.aiaengine.Model;

import java.io.FileNotFoundException;

public class DeleteModelApp {
    public static void main(String[] args) throws FileNotFoundException {
        Engine engine = new Engine();
        //replace with your model id
        Model model = engine.getModel("");
        model.delete();
    }
}