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 false 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 false 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 regression models docid\ pfnkdj1fwsevxoondal9k , classification models docid 67w1y2nzakexornpizk e , clustering and dimension reduction models docid\ tlugzlmibs6dstwsbeagw , or other models docid\ pahgmmey3oefcapzzu50i 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 option list 136,170,350 false true left unhandled content type left unhandled content type left unhandled content type left false unhandled content type left false unhandled content type left false 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 a machine learning model use the if exists clause to ignore any models that do not exist syntax alter mlmodel \[if exists] \<model name> rename to \<new model name> 148,160,350 false 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 false 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 a 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 false 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 false 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 machine learning in ocient docid\ dqt aansysg4i2sm sixn machine learning model functions docid\ dsqzzzggetdfwh5qasvhg regression models docid\ pfnkdj1fwsevxoondal9k classification models docid 67w1y2nzakexornpizk e clustering and dimension reduction models docid\ tlugzlmibs6dstwsbeagw other models docid\ pahgmmey3oefcapzzu50i