Using Math.Net numerics, I would like to do a task:
Fold through each column, and multiply that column's value by the index of my vector. The problem is, none of the folding functions yield a counter...and counting within the folding functions is problematic...and for loops are death for this kind of thing...
Anyhow, ideally I would do something like:
points.FoldByColumn(fun i acc x -> acc <- acc + x * coefficients_array.[i])
|> Array.map(fun x -> x + coefficients_array.[coefficients_array.length-1])
(this is written in F# syntax).
The statement is exactly equivalent to this statement in Python using Numpy broadcasting:
return (self.model_coefs[:-1] * points).sum(axis = 1) + self.model_coefs[-1]
What it is doing is multiplying a set of points by their linear regression coefficients, and turning them into a single predicted point.
(Or am I really just crazy to try to do this stuff on .NET??)