I’m trying to do just some simple stuff and having issues getting it to work. Here are some of those items. (I’m using F#)

- Transposing a Vector
- Summing all items in the resulting matrix

I’m just doing basic numerical computation using floats. Writing some ML algorithms from scratch so I learn the library and some ML while I’m at it.

See below:

let SumSquares (theta:Vector) (y:float) (trainingData:Matrix) : CostFunction =

let m = trainingData.RowCount

trainingData

|> Matrix.mapRows(fun a r -> vector[ square((theta * r) - y) ])

|> Matrix.sum()

matrix.map should have the theta transposed (I can do so before hand I suppose, but either way).

Matrix.sum should add all items. perhaps matrix.fold is correct? Not seeing good examples on how to use that guy.