I’m calculating linear regressions based on a data set. I do not know the regression model or number of parameters at compile-time.
I’m storing the regression equation in a SQL Server 2005 database as the string
y = 3x^2 + 2x // just an example
When I need to make a prediction, I grab the equation from the database, substitue x with the value I’m predicting, and use NCalc to evaluate the resulting string.
That method seems to work OK, but I’m wondering if there’s a better way or a built-in feature of SQL Server that I’ve missed that would allow me to do these calculations on the database side.
You could write a CLR stored procedure that still uses NCalc to do the calculation.