You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*A Python library that converts custom SQL-like statements into standard SQL queries for machine learning workflows on tables in modern data management systems.*
TLSQL simplifies machine learning on structured tables by converting SQL-like statements into standard SQL queries. This allows data scientists and engineers to focus on modeling rather than writing complex SQL or managing datasets manually.
21
-
22
-
TLSQL supports three types of statements that map directly to ML workflows:
23
-
24
-
-**`TRAIN WITH`**: Specifies the training set
25
-
-**`PREDICT VALUE`**: Specifies the test set
26
-
-**`VALIDATE WITH`**: Specifies the validation set
22
+
TLSQL is a system designed to simplify machine learning workflows on structured tabular data. It translates SQL-like statements into standard SQL queries and structured learning task descriptions, enabling data scientists and engineers to focus on model development instead of writing complex SQL or manually managing datasets.
27
23
28
24
TLSQL works seamlessly with **RDBs, data warehouses, and data lakes**, enabling end-to-end table-based ML workflows.
29
25
26
+
-**`PREDICT VALUE`**: Specifies the test set.
27
+
-**`TRAIN WITH`**: Specifies the training set.
28
+
-**`VALIDATE WITH`**: Specifies the validation set.
The `TRAIN WITH` statement specifies which columns and tables to use for training data, along with optional filtering conditions. This statement defines the dataset used to train your machine learning model.
40
+
The `PREDICT VALUE` statement specifies the target column for prediction and the task type (classification or regression). This statement defines the test set - the data for which you want to make predictions. The `WHERE` clause in this statement filters which rows are included in the test set.
The `PREDICT VALUE` statement specifies the target column for prediction and the task type (classification or regression). This statement defines the test set - the data for which you want to make predictions. The `WHERE` clause in this statement filters which rows are included in the test set.
65
+
The `TRAIN WITH` statement specifies which columns and tables to use for training data, along with optional filtering conditions. This statement defines the dataset used to train your machine learning model.
The `VALIDATE WITH` statement specifies validation data with the same syntax as `TRAIN WITH`. This statement defines the validation set used for model selection. If omitted, the pipeline will use k-fold cross-validation on the training data.
85
+
The `VALIDATE WITH` statement specifies validation data with the same syntax as `TRAIN WITH`. This statement defines the validation set used for model selection. If omitted, `validate_result`will be `None`.
81
86
82
87
#### Syntax
83
88
84
89
```sql
85
-
VALIDATE WITH (column_selectors)
86
-
FROMtable1, table2, ...
90
+
VALIDATE WITH column_selector
91
+
FROMtable
87
92
[WHERE conditions]
88
93
```
89
94
90
95
#### Examples
91
96
92
97
```sql
93
-
VALIDATE WITH (users.*, movies.*, ratings.*)
94
-
FROM users, movies, ratings
95
-
WHEREusers.Gender='M'ANDmovies.Year<2000
98
+
VALIDATE WITH (users.Age)
99
+
FROM users
100
+
WHEREusers.Gender='M'andusers.userID>3000
96
101
```
97
102
98
103
## Supported Operators
@@ -125,11 +130,14 @@ This will install TLSQL in development mode, allowing you to make changes to the
125
130
```python
126
131
import tlsql
127
132
128
-
129
-
result = tlsql.convert("PREDICT VALUE(users.Age, CLF) FROM users")
130
-
print(result.statement_type) # 'PREDICT'
131
-
print(result.target_column) # 'users.Age'
132
-
print(result.task_type) # 'CLF'
133
+
# Workflow mode: PREDICT only (auto-generates TRAIN)
134
+
result = tlsql.convert(
135
+
predict_query="PREDICT VALUE(users.Age, CLF) FROM users WHERE users.Gender='F'"
0 commit comments