---
title: Machine Learning in Ocient
slug: HsP8GJQe8e7tqDjMEvZfJ
description: Integrate machine learning models into Ocient queries with OcientML for advanced data analysis, empowering predictive and classification insights.
docTags: 
createdAt: Mon Jan 30 2023 22:01:43 GMT+0000 (Coordinated Universal Time)
updatedAt: Mon Mar 30 2026 18:52:39 GMT+0000 (Coordinated Universal Time)
---

The Ocient Data Intelligence Platform™ 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.&#x20;

## Linear Algebra in Ocient

matrices are a first-class data type in the Ocient System. Create a matrix using a simple SQL SELECT statement.

```sql
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`.

```sql
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.

```sql
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:&#x20;

- [Regression Analysis](<./Machine Learning in Ocient/Regression Analysis.md>)
- [Classification Analysis](<./Machine Learning in Ocient/Classification Analysis.md>)
- [Clustering Analysis and Dimensionality Reduction](<./Machine Learning in Ocient/Clustering Analysis and Dimensionality Reduction.md>)

## Related Links

[Machine Learning Model Functions](<././SQL Reference/Machine Learning Model Functions.md>)&#x20;

[Regression Models](<././SQL Reference/Machine Learning Model Functions/Regression Models.md>)&#x20;

