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 136,171,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type model type 136,175,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 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 136,170,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 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> 148,160,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 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 \[, ] 136,177,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 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> 136,176,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 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> 136,174,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example refresh mlmodel my model; related links docid\ pstuxvbgmg7vzwjjvyxpd docid\ ydyzvrbfpkxymmiv3bid1 docid\ vnnvgywudilgqn1tmn4 j docid\ oz7w9viouqc4ledje98yp docid\ ol65mcdaukgeishjo0lhs docid\ fjshnbf3erq wkd6tzrjo