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.
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.
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
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
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();
}
}