SQL Reference
Data Definition Language (DDL)...
Machine Learning Models
{{ocientml}} functionality enables you to create a machine learning model, rename the model, export the syntax for the model creation, retrain the model, execute a query against the model, and drop the model create mlmodel train a new machine learning model of type \<model type> on the result set returned by the sql select statement after the database creates the model, \<model name> becomes a callable function in sql select statements syntax create \[ or replace ] mlmodel \<model name> type \<model type> on( \<sql select statement> ) \[options(\<option list>)] model name parameter data type description model name varchar the name of the model to create model type parameter data type description model type varchar the type of machine learning model to create these models are supported you can find full descriptions of each model in docid\ vnnvgywudilgqn1tmn4 j , docid\ oz7w9viouqc4ledje98yp , docid\ ol65mcdaukgeishjo0lhs , or docid\ fjshnbf3erq wkd6tzrjo simple linear regression multiple linear regression polynomial regression linear combination regression vector autoregression kmeans knn (k nearest neighbors) logistic regression naive bayes nonlinear regression feedforward network principal component analysis linear discriminant analysis support vector machine decision tree gaussian mixture model association rules gradient boosted trees regression tree option list parameter data type description option list varchar the options for the specified machine learning model that is specified as a comma separated list in the format \<option name 1> > \<value 1>, \<option name 2> > \<value 2> , and so on names and values must be all enclosed in single quotes and are case sensitive with the exception that boolean values can be true , false , true , or false refer to the respective model for the full options list example options list options( 'yintercept' > '10', 'metrics' > 'true' ) the sql select statement that serves as the basis for the model must return rows that fit the specified requirements of the model for example, in multiple linear regression, the first n columns are the independent variables, and the last column is the dependent variable you cannot create a machine learning model with an existing schema and name combination example assume you created the mldata table that contains the data for the model then, you can create the my model machine learning model based on that data create mlmodel my model type simple linear regression on ( select x1, y from mldata ) options( 'yintercept' > '10', 'metrics' > 'true' ); alter mlmodel rename rename a machine learning model use the if exists clause to ignore any models that do not exist required privileges to rename a view, you must have the alter mlmodel privilege for the model the ocient system requires these privileges if this statement includes a change to the schema view privilege on the current schema of the model view mlmodel and create mlmodel privileges on the target schema (if the schema already exists) create mlmodel privilege on the database (if the schema does not exist) syntax alter mlmodel \[if exists] \<model name> rename to \<new model name> parameter data type description model name varchar the name of the model to rename new model name varchar the new name of the model example alter mlmodel my model rename to my model slr; drop mlmodel drop a machine learning model use the if exists clause to ignore any models that do not exist syntax drop mlmodel \[if exists] model name \[, ] parameter data type description model name varchar the name of the model to drop you can drop multiple models by specifying additional names and separating each with commas example drop the machine learning model my model drop mlmodel my model; dr op multiple machine learning models drop mlmodel my model1, my model2; export mlmodel return the sql statement that can recreate the machine learning model syntax export mlmodel \<model name> parameter data type description model name varchar the name of the model to create example export mlmodel my model; output export \ create mlmodel "my schema" "my model" type simple linear regression on(select x, y from mldemo slr) options('metrics' > 'false'); fetched 1 row the output sql statement includes the schema explicitly refresh mlmodel retrain a machine learning model without changing any model options syntax refresh mlmodel \<model name> parameter data type description model name varchar the name of the model to retrain example refresh mlmodel my model; related links docid\ pstuxvbgmg7vzwjjvyxpd docid\ ydyzvrbfpkxymmiv3bid1 docid\ vnnvgywudilgqn1tmn4 j docid\ oz7w9viouqc4ledje98yp docid\ ol65mcdaukgeishjo0lhs docid\ fjshnbf3erq wkd6tzrjo