You might want to consider checking out ClickHouse which supports many ML functions natively:
- stochasticLinearRegression (https://clickhouse.com/docs/en/sql-reference/aggregate-funct...)
- stochasticLogisticRegression (https://clickhouse.com/docs/en/sql-reference/aggregate-funct...)