CNTK C#Logistic回归w和b变量值 [英] CNTK c# logistic regression w and b variable values

查看:150
本文介绍了CNTK C#Logistic回归w和b变量值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道CNTK for C#是一种新事物,但我希望有人能帮助我.我在python中跟踪了这个逻辑回归示例: https://github.com/Microsoft/CNTK/blob/master/教程/CNTK_101_Lo​​gisticRegression.ipynb 运行此C#示例: https://github.com/Microsoft/CNTK/blob/master/Examples/TrainingCSharp/Common/LogisticRegression.cs

I know CNTK for C# is kind of new but I hope someone can help me out. I was folling this logistic regression example in python: https://github.com/Microsoft/CNTK/blob/master/Tutorials/CNTK_101_LogisticRegression.ipynb to run this C# example: https://github.com/Microsoft/CNTK/blob/master/Examples/TrainingCSharp/Common/LogisticRegression.cs

我更改了几行以显示结果,并且代码运行无误,但我想获取权重矩阵和偏差矢量的值,因此可以在图表中画出2类之间的一条线.有人知道哪个变量包含这些值以及如何输出它们吗?教练变量? classifierOutput函数?

I changed a few lines to display the result and the code runs without errors but I would like to get the values of the weight matrix and bias vector so I can draw in my chart a line between 2 classes. Does someone know which variable contains these values and how to output them? trainer variable? classifierOutput function?

推荐答案

创建线性模型时,具有weightParambiasParam参数.您可以通过以下方法从这些参数获取数据:

When you create the linear model, you have the weightParam and biasParam parameters. Here is how you can get data from these parameters:

NDArrayView weightArrayView = weightParam.Value();
Value weightValue = new Value(weightArrayView);
IList<IList<float>> weightData = weightValue.GetDenseData<float>(weightParam);

这篇关于CNTK C#Logistic回归w和b变量值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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