Model function commandsÂļ
Model function commands allow you to see the functions (also called methods) of machine learning models.
You can create and manage models and their methods in Python using the Snowpark Model Registry API.
Calling model methodsÂļ
You can call or invoke methods of a model using the MODEL(model_name)!method_name(...)
syntax. The methods
available on a model are determined by the underlying Python model class. For example, many types of models use a method
named predict
for inference.
Methods are attached to specific model versions. To invoke a method on the default version of a model, use the syntax shown below, passing arguments to the method, if any, between the parentheses, and providing the name of the table containing the inference data in the FROM clause.
SELECT MODEL(<model_name>)!<method_name>(...) FROM <table_name>;
To invoke a method of a specific version of a model, first create an alias to the specific version of the model using WITH, then invoke the desired function through the alias.
SELECT MODEL(<model_name>,<version_or_alias_name>)!<method_name>(...) FROM <table_name>;
For example, to call the latest version of a model through the LAST alias:
SELECT MODEL(my_model,LAST)!predict(...) FROM my_table;