I'm trying to implement a cost function and I currently have
let computeCost (X : Matrix<double>) (y : Vector<double>) (theta : Vector<double>) =
let m = y.Count |> double
let J = (1.0/(2.0*m))*(((X*theta - y) |> Vector.map (fun x -> x*x)).Sum)
J
For some reason I get an error on the half after the first * saying "This function takes too many arguments, or is used in a context where a function is not expected."
However, when I do this
let computeCost (X : Matrix<double>) (y : Vector<double>) (theta : Vector<double>) =
let m = y.Count |> double
let J = (((X*theta - y) |> Vector.map (fun x -> x*x)).Sum)
J
It works perfectly fine and it says that val J:float
which is what I expect. But as soon as add in the second piece which is the (1.0/(2.0*m))
part I get the error. I have parenthesis around everything so I don't see how it can be some partial function being applied or something along those lines. I'm sure it's something dumb but I can't seem to figure it out.