Skip to main content
The Ocient Hyperscale Data Warehouse™ has OcientML™ functionality that enables machine learning training and model execution within the database. Whether you are training a model or using machine learning functionality to do scoring or prediction, OcientML enables machine learning in the SQL syntax directly. You can use the CREATE MLMODEL SQL statement to create models. This step is for model training and is referred to as model creation. Similarly, you can use the model on new input data to generate new predictions by executing the scalar function that has the same name as the model. This action is typically referred to as executing the model. Machine learning in Ocient® depends upon linear algebra functionality that is built into the Ocient System. OcientML provides machine learning capabilities that you can invoke in SQL statements with some application logic.

Linear Algebra in Ocient

Matrixes are a first-class data type in the Ocient System. Create a matrix using a simple SQL SELECT statement.
SELECT {{1, 2}, {3, 4}};
{{1,2},{3,4}}
--------------------------------------------------------------------------------
[[1.0, 2.0], [3.0, 4.0]]

Fetched 1 row

SELECT {{c1*1, c1*2}, {c1*3, c1*4}} FROM sys.dummy2;
make_matrix_2x2((2), (2), ((1))*(c1), ((2))*(c1), ((3))*(c1), ((4))*(c1))
--------------------------------------------------------------------------------
[[1.0, 2.0], [3.0, 4.0]]
[[2.0, 4.0], [6.0, 8.0]]

Fetched 2 rows
You can also use shorthand notations to create row _r or column vectors _c. For example, _r{1,2,3} creates a row vector with values 1.0, 2.0, and 3.0.
SELECT _r{1,2,3};
_r{1,2,3}
--------------------------------------------------------------------------------
[[1.0, 2.0, 3.0]]

Fetched 1 row

SELECT _c{1,2,3};
_c{1,2,3}
--------------------------------------------------------------------------------
[[1.0], [2.0], [3.0]]

Fetched 1 row
You can execute functions using the values in the vectors. This query does some matrix arithmetic, finds the inverse matrix, and then returns the two eigenvalues and eigenvectors of the inverse.
SELECT EIGEN(INVERSE(2 * {{1,2},{3,4}} + {{5,6},{7,8}} / 2));
EIGEN(INVERSE((((2))*({{1,2},{3,4}}))+(({{5,6},{7,8}})/((2)))))
--------------------------------------------------------------------------------
[<<-1.3780529228406495, [[0.8013353799887076, -0.5982153531783962]]>>, <<0.05805292284064968, [[0.48196559267508465, 0.8761901434491]]>>]

Fetched 1 row

Machine Learning Models

Ocient supports regression, classification, and clustering models. Also, Ocient supports models for dimensionality reduction. For guides on using the different OcientML™ models, see: Machine Learning Model Functions Regression Models