MathNet通过矩阵提高标量 [英] MathNet Raise Scalar by a Matrix

查看:134
本文介绍了MathNet通过矩阵提高标量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MathNumerics线性代数库在.net中实现Logistic回归.我需要实现以下等式,并且不确定如何通过矩阵完成e的计算.

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))

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

其中Z是矩阵,E是数学常数e.

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

所以代码中有问题的部分是E.^ Z

So the problematic section of code is E .^ Z

推荐答案

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

这篇关于MathNet通过矩阵提高标量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆