MathNet Raise Scalar by a Matrix

雨燕双飞 提交于 2019-11-28 09:48:39

问题


I'm attempting to implement Logistic regression in .net using MathNumerics Linear Algebra libraries. I need to implement the following equation and am unsure of how to accomplish raising e by a matrix.

1.0 ./ (1.0 + E .^ (-1 .* Z))

where Z is a matrix and E is the mathematical constant e.

So the problematic section of code is E .^ Z


回答1:


let sigmoid (z : Matrix<double>) : Matrix<double> =
        z.Map (fun x -> 1.0 / (1.0 + exp (0.0 - x)))


来源:https://stackoverflow.com/questions/37593876/mathnet-raise-scalar-by-a-matrix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!