Live data from Hacker News

Stochastic gradient descent written in SQL

maxhalford.github.io

51–60 of 187 posts

Re: Stochastic gradient descent written in SQL

#51
From a comment by the author:

> Also, I can't justify why, but my gut feeling is that the database should be an order of magnitude faster than Python, provided the implementation were to be improved.

Would be curious how that could end up being the case. Perhaps if NumPy wasn't used at all? That would mean no vectorization or optimized storage.

Would be interesting to see how it scaled with length and dimensionality

Re: Stochastic gradient descent written in SQL

#55

Earlier quoted context omitted.

With “traditional” RDBMS systems, putting a lot of code in the DB lead to a lot of scaling issues where you’d need gigantic machines with a lot of RAM and CPU: because the DB was doing so much work. It was expensive and clunky to get HA right. In more modern DBs being distributed horizontally, this approach may see a rebound. The big “but” is still costs, in my experience in AWS as an example, managed Postgres Aurora…

Why would running code in a database process be intrinsically more expensive than running it in some other process?

The issue is that many relational databases are not horizontally scalable, so you want to be frugal with their resources.

Re: Stochastic gradient descent written in SQL

#56

Earlier quoted context omitted.

With “traditional” RDBMS systems, putting a lot of code in the DB lead to a lot of scaling issues where you’d need gigantic machines with a lot of RAM and CPU: because the DB was doing so much work. It was expensive and clunky to get HA right. In more modern DBs being distributed horizontally, this approach may see a rebound. The big “but” is still costs, in my experience in AWS as an example, managed Postgres Aurora…

Why would running code in a database process be intrinsically more expensive than running it in some other process?

you can easily scale linearly your app layer on multiple machines, while it is harder with previous gen databases.

Re: Stochastic gradient descent written in SQL

#57
post #55

Earlier quoted context omitted.

Why would running code in a database process be intrinsically more expensive than running it in some other process?

The issue is that many relational databases are not horizontally scalable, so you want to be frugal with their resources.

The resources I'm familiar with are I/O, memory, and CPU. The only one I believe can be spared in the database by using that resource outside of the database, is CPU. When the database is far from saturated on CPU and latency and throughput are determined by I/O and memory, using CPU on some other machine that isn't the database can't possibly have any impact on latency and throughput.

Re: Stochastic gradient descent written in SQL

#58

Earlier quoted context omitted.

Why would running code in a database process be intrinsically more expensive than running it in some other process?

you can easily scale linearly your app layer on multiple machines, while it is harder with previous gen databases.

What good is that going to do if the data always resides in the database?

Re: Stochastic gradient descent written in SQL

#59

>A machine learning algorithm which can be trained using SQL opens a world of possibilities. The model and the data live in the same space. This is as simple as it gets in terms of architecture. Basically, you only need a database which runs SQL. First paragraph of the conclusion, and this very much fits with the mindset that's been growing in me in the data world over the past few years. Databases are much more powe…

There is a recent trend in database research, ML in databases. Not sure how much an impact it can make though, the sweet spot is doing relatively linear stuff, arguably just a step up from analytical functions in queries, while cutting edge ML needs dedicated GPUs for compute load and often uses unstructured and even binary data.

Re: Stochastic gradient descent written in SQL

#60

>A machine learning algorithm which can be trained using SQL opens a world of possibilities. The model and the data live in the same space. This is as simple as it gets in terms of architecture. Basically, you only need a database which runs SQL. First paragraph of the conclusion, and this very much fits with the mindset that's been growing in me in the data world over the past few years. Databases are much more powe…

> Databases are much more powerful than we think And a function of what people think is attitudes towards working at the DB level. I see this often with ORM's in the web dev sphere (rather than Dat Science). Yes, ORM's are great but many people rely on them to completely abstract away the database and are terrified by raw sql or even query building. You also see it with services that abstract away the backend like Po…

Opposite here - dont like ORMs. Too much overhead - though i get their value.
Post reply on HN